{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f692935a",
   "metadata": {},
   "source": [
    "![avatar](images/softmax.png)\n",
    "\n",
    "看一下分类问题，还是拿平面上的点分布来说，平面上有很多(x,y)点，绿色*分布在上面，蓝色x分布在下面，怎么样找到一条分割线，能把两种不同的点分割开来？\n",
    "下面，我们还是用numpy生成这样的点\n",
    "\n",
    "分类问题：\n",
    "1. sigmod,softmax\n",
    "2. 损失函数，最大似然，交叉熵\n",
    "3. 分类问题的评估指标"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "897aafb4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 1.00000000e+00  3.67561870e-01  3.78859061e+00]\n",
      " [ 0.00000000e+00  4.14661940e-01  5.66694829e+00]\n",
      " [ 0.00000000e+00  6.02763376e-01  1.09556861e+01]\n",
      " [ 1.00000000e+00  6.77816537e-01  5.64184116e+00]\n",
      " [ 0.00000000e+00  6.66766715e-01  7.78086404e+00]\n",
      " [ 1.00000000e+00  6.60173537e-01  2.77879568e+00]\n",
      " [ 0.00000000e+00  5.68433949e-01  9.30453034e+00]\n",
      " [ 1.00000000e+00  3.96505741e-01  7.03511992e-01]\n",
      " [ 1.00000000e+00  6.06393214e-01  4.91234263e+00]\n",
      " [ 0.00000000e+00  6.70637870e-01  7.26914616e+00]\n",
      " [ 1.00000000e+00  8.81103197e-01  7.34694556e+00]\n",
      " [ 1.00000000e+00  6.99479275e-01  2.88711838e+00]\n",
      " [ 1.00000000e+00  8.91923355e-01  2.73775483e+00]\n",
      " [ 1.00000000e+00  6.18015429e-01  5.26660636e+00]\n",
      " [ 1.00000000e+00  1.00226887e-01  2.36406130e+00]\n",
      " [ 1.00000000e+00  9.52749012e-01  7.41791008e+00]\n",
      " [ 0.00000000e+00  3.15428351e-01  8.72184190e+00]\n",
      " [ 1.00000000e+00  9.62188545e-01  4.73314490e+00]\n",
      " [ 1.00000000e+00  2.48753144e-01  3.62466580e+00]\n",
      " [ 0.00000000e+00  7.74233689e-01  8.94248342e+00]\n",
      " [ 1.00000000e+00  3.01574817e-01 -1.32532384e-01]\n",
      " [ 0.00000000e+00  5.68044561e-01  9.12187075e+00]\n",
      " [ 0.00000000e+00  3.83441519e-01  6.13933555e+00]\n",
      " [ 0.00000000e+00  9.43748079e-01  1.05984729e+01]\n",
      " [ 0.00000000e+00  8.32619846e-01  7.64860561e+00]\n",
      " [ 0.00000000e+00  5.44883183e-01  6.23463997e+00]\n",
      " [ 1.00000000e+00  2.90077607e-01  4.29119339e+00]\n",
      " [ 1.00000000e+00  7.03888584e-01  4.06714887e+00]\n",
      " [ 1.00000000e+00  1.35474064e-01  7.91227378e-01]\n",
      " [ 1.00000000e+00  8.96546596e-01  5.49162767e+00]\n",
      " [ 0.00000000e+00  3.59507901e-01  6.39038427e+00]\n",
      " [ 0.00000000e+00  4.37587211e-01  8.45347768e+00]\n",
      " [ 0.00000000e+00  7.15189366e-01  8.76895440e+00]\n",
      " [ 0.00000000e+00  7.80529176e-01  9.92687348e+00]\n",
      " [ 0.00000000e+00  6.16933997e-01  6.55437254e+00]\n",
      " [ 0.00000000e+00  2.64555612e-01  5.91269396e+00]\n",
      " [ 0.00000000e+00  1.87898004e-02  5.92695627e+00]\n",
      " [ 1.00000000e+00  6.92531590e-01  5.60450956e+00]\n",
      " [ 1.00000000e+00  8.81735362e-01  3.75872400e+00]\n",
      " [ 0.00000000e+00  9.44668917e-01  8.32432739e+00]\n",
      " [ 0.00000000e+00  7.91725038e-01  7.75347311e+00]\n",
      " [ 0.00000000e+00  1.43353287e-01  5.13080125e+00]\n",
      " [ 1.00000000e+00  4.47125379e-01  1.74848303e+00]\n",
      " [ 0.00000000e+00  6.81820299e-01  1.10555825e+01]\n",
      " [ 1.00000000e+00  5.72251906e-01  3.01575584e+00]\n",
      " [ 0.00000000e+00  5.28894920e-01  6.19635030e+00]\n",
      " [ 0.00000000e+00  1.28926298e-01  3.74516922e+00]\n",
      " [ 0.00000000e+00  8.71292997e-02  5.27927235e+00]\n",
      " [ 1.00000000e+00  7.35194022e-01  5.86350544e+00]\n",
      " [ 1.00000000e+00  5.69964911e-01  1.17875456e+00]\n",
      " [ 0.00000000e+00  6.45894113e-01  7.03601815e+00]\n",
      " [ 1.00000000e+00  9.98847007e-01  5.82215191e+00]\n",
      " [ 1.00000000e+00  1.91931983e-02  1.36920759e+00]\n",
      " [ 0.00000000e+00  8.91773001e-01  8.72532302e+00]\n",
      " [ 1.00000000e+00  6.52103270e-01  2.60990620e+00]\n",
      " [ 0.00000000e+00  6.17635497e-01  7.41512494e+00]\n",
      " [ 1.00000000e+00  8.46408672e-01  4.96432995e+00]\n",
      " [ 0.00000000e+00  4.23654799e-01  6.16265778e+00]\n",
      " [ 1.00000000e+00  9.19482614e-01  6.32563066e+00]\n",
      " [ 0.00000000e+00  9.78618342e-01  1.27753890e+01]\n",
      " [ 1.00000000e+00  6.53200820e-01  3.31645422e+00]\n",
      " [ 0.00000000e+00  4.61479362e-01  1.01912023e+01]\n",
      " [ 0.00000000e+00  7.10360582e-02  4.33809210e+00]\n",
      " [ 0.00000000e+00  6.97631196e-01  7.14714529e+00]\n",
      " [ 1.00000000e+00  4.23855049e-01  1.15078673e+00]\n",
      " [ 0.00000000e+00  6.39921021e-01  6.39554407e+00]\n",
      " [ 1.00000000e+00  5.74325249e-01  3.19346223e+00]\n",
      " [ 1.00000000e+00  8.13797820e-01  2.19138157e+00]\n",
      " [ 1.00000000e+00  5.76157334e-01  1.64074553e+00]\n",
      " [ 1.00000000e+00  5.90872761e-01  2.88453403e+00]\n",
      " [ 0.00000000e+00  9.25596638e-01  8.31889795e+00]\n",
      " [ 1.00000000e+00  7.14241300e-01  6.28106070e+00]\n",
      " [ 1.00000000e+00  9.56083635e-01  6.78043555e+00]\n",
      " [ 0.00000000e+00  8.70012148e-01  7.83055278e+00]\n",
      " [ 0.00000000e+00  4.56150332e-01  5.60148914e+00]\n",
      " [ 1.00000000e+00  5.92041931e-01  1.92361486e+00]\n",
      " [ 0.00000000e+00  9.63662761e-01  1.01498677e+01]\n",
      " [ 1.00000000e+00  2.70007973e-01  9.40957912e-03]\n",
      " [ 1.00000000e+00  5.81272873e-01  4.10647404e+00]\n",
      " [ 1.00000000e+00  8.06193989e-01  3.33321597e+00]\n",
      " [ 0.00000000e+00  1.18274426e-01  7.28769003e+00]\n",
      " [ 0.00000000e+00  6.12095723e-01  8.67671888e+00]\n",
      " [ 0.00000000e+00  2.02183974e-02  7.20605814e+00]\n",
      " [ 1.00000000e+00  2.97436951e-01  1.55273125e-01]\n",
      " [ 0.00000000e+00  5.48813504e-01  8.59505137e+00]\n",
      " [ 1.00000000e+00  2.23081633e-01  2.07949168e+00]\n",
      " [ 1.00000000e+00  4.28768701e-01  2.03645150e+00]\n",
      " [ 0.00000000e+00  5.21848322e-01  7.08994260e+00]\n",
      " [ 1.00000000e+00  4.31418435e-01  3.59736720e+00]\n",
      " [ 1.00000000e+00  6.43990199e-01  6.12734202e+00]\n",
      " [ 0.00000000e+00  7.99158564e-01  9.33904883e+00]\n",
      " [ 0.00000000e+00  2.10382561e-01  6.98447748e+00]\n",
      " [ 0.00000000e+00  4.37031954e-01  8.52221167e+00]\n",
      " [ 0.00000000e+00  3.63710771e-01  4.84203124e+00]\n",
      " [ 1.00000000e+00  2.98282326e-01  3.30194752e+00]\n",
      " [ 0.00000000e+00  6.02254716e-02  6.88276338e+00]\n",
      " [ 1.00000000e+00  4.35864925e-01  4.24835960e+00]\n",
      " [ 0.00000000e+00  7.78156751e-01  1.10805083e+01]\n",
      " [ 1.00000000e+00  5.01324382e-01  5.23493197e+00]\n",
      " [ 1.00000000e+00  7.25254280e-01  4.02108837e+00]]\n",
      "[[1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]]\n",
      "[[ 3.67561870e-01  3.78859061e+00]\n",
      " [ 4.14661940e-01  5.66694829e+00]\n",
      " [ 6.02763376e-01  1.09556861e+01]\n",
      " [ 6.77816537e-01  5.64184116e+00]\n",
      " [ 6.66766715e-01  7.78086404e+00]\n",
      " [ 6.60173537e-01  2.77879568e+00]\n",
      " [ 5.68433949e-01  9.30453034e+00]\n",
      " [ 3.96505741e-01  7.03511992e-01]\n",
      " [ 6.06393214e-01  4.91234263e+00]\n",
      " [ 6.70637870e-01  7.26914616e+00]\n",
      " [ 8.81103197e-01  7.34694556e+00]\n",
      " [ 6.99479275e-01  2.88711838e+00]\n",
      " [ 8.91923355e-01  2.73775483e+00]\n",
      " [ 6.18015429e-01  5.26660636e+00]\n",
      " [ 1.00226887e-01  2.36406130e+00]\n",
      " [ 9.52749012e-01  7.41791008e+00]\n",
      " [ 3.15428351e-01  8.72184190e+00]\n",
      " [ 9.62188545e-01  4.73314490e+00]\n",
      " [ 2.48753144e-01  3.62466580e+00]\n",
      " [ 7.74233689e-01  8.94248342e+00]\n",
      " [ 3.01574817e-01 -1.32532384e-01]\n",
      " [ 5.68044561e-01  9.12187075e+00]\n",
      " [ 3.83441519e-01  6.13933555e+00]\n",
      " [ 9.43748079e-01  1.05984729e+01]\n",
      " [ 8.32619846e-01  7.64860561e+00]\n",
      " [ 5.44883183e-01  6.23463997e+00]\n",
      " [ 2.90077607e-01  4.29119339e+00]\n",
      " [ 7.03888584e-01  4.06714887e+00]\n",
      " [ 1.35474064e-01  7.91227378e-01]\n",
      " [ 8.96546596e-01  5.49162767e+00]\n",
      " [ 3.59507901e-01  6.39038427e+00]\n",
      " [ 4.37587211e-01  8.45347768e+00]\n",
      " [ 7.15189366e-01  8.76895440e+00]\n",
      " [ 7.80529176e-01  9.92687348e+00]\n",
      " [ 6.16933997e-01  6.55437254e+00]\n",
      " [ 2.64555612e-01  5.91269396e+00]\n",
      " [ 1.87898004e-02  5.92695627e+00]\n",
      " [ 6.92531590e-01  5.60450956e+00]\n",
      " [ 8.81735362e-01  3.75872400e+00]\n",
      " [ 9.44668917e-01  8.32432739e+00]\n",
      " [ 7.91725038e-01  7.75347311e+00]\n",
      " [ 1.43353287e-01  5.13080125e+00]\n",
      " [ 4.47125379e-01  1.74848303e+00]\n",
      " [ 6.81820299e-01  1.10555825e+01]\n",
      " [ 5.72251906e-01  3.01575584e+00]\n",
      " [ 5.28894920e-01  6.19635030e+00]\n",
      " [ 1.28926298e-01  3.74516922e+00]\n",
      " [ 8.71292997e-02  5.27927235e+00]\n",
      " [ 7.35194022e-01  5.86350544e+00]\n",
      " [ 5.69964911e-01  1.17875456e+00]\n",
      " [ 6.45894113e-01  7.03601815e+00]\n",
      " [ 9.98847007e-01  5.82215191e+00]\n",
      " [ 1.91931983e-02  1.36920759e+00]\n",
      " [ 8.91773001e-01  8.72532302e+00]\n",
      " [ 6.52103270e-01  2.60990620e+00]\n",
      " [ 6.17635497e-01  7.41512494e+00]\n",
      " [ 8.46408672e-01  4.96432995e+00]\n",
      " [ 4.23654799e-01  6.16265778e+00]\n",
      " [ 9.19482614e-01  6.32563066e+00]\n",
      " [ 9.78618342e-01  1.27753890e+01]\n",
      " [ 6.53200820e-01  3.31645422e+00]\n",
      " [ 4.61479362e-01  1.01912023e+01]\n",
      " [ 7.10360582e-02  4.33809210e+00]\n",
      " [ 6.97631196e-01  7.14714529e+00]\n",
      " [ 4.23855049e-01  1.15078673e+00]\n",
      " [ 6.39921021e-01  6.39554407e+00]\n",
      " [ 5.74325249e-01  3.19346223e+00]\n",
      " [ 8.13797820e-01  2.19138157e+00]\n",
      " [ 5.76157334e-01  1.64074553e+00]\n",
      " [ 5.90872761e-01  2.88453403e+00]\n",
      " [ 9.25596638e-01  8.31889795e+00]\n",
      " [ 7.14241300e-01  6.28106070e+00]\n",
      " [ 9.56083635e-01  6.78043555e+00]\n",
      " [ 8.70012148e-01  7.83055278e+00]\n",
      " [ 4.56150332e-01  5.60148914e+00]\n",
      " [ 5.92041931e-01  1.92361486e+00]\n",
      " [ 9.63662761e-01  1.01498677e+01]\n",
      " [ 2.70007973e-01  9.40957912e-03]\n",
      " [ 5.81272873e-01  4.10647404e+00]\n",
      " [ 8.06193989e-01  3.33321597e+00]\n",
      " [ 1.18274426e-01  7.28769003e+00]\n",
      " [ 6.12095723e-01  8.67671888e+00]\n",
      " [ 2.02183974e-02  7.20605814e+00]\n",
      " [ 2.97436951e-01  1.55273125e-01]\n",
      " [ 5.48813504e-01  8.59505137e+00]\n",
      " [ 2.23081633e-01  2.07949168e+00]\n",
      " [ 4.28768701e-01  2.03645150e+00]\n",
      " [ 5.21848322e-01  7.08994260e+00]\n",
      " [ 4.31418435e-01  3.59736720e+00]\n",
      " [ 6.43990199e-01  6.12734202e+00]\n",
      " [ 7.99158564e-01  9.33904883e+00]\n",
      " [ 2.10382561e-01  6.98447748e+00]\n",
      " [ 4.37031954e-01  8.52221167e+00]\n",
      " [ 3.63710771e-01  4.84203124e+00]\n",
      " [ 2.98282326e-01  3.30194752e+00]\n",
      " [ 6.02254716e-02  6.88276338e+00]\n",
      " [ 4.35864925e-01  4.24835960e+00]\n",
      " [ 7.78156751e-01  1.10805083e+01]\n",
      " [ 5.01324382e-01  5.23493197e+00]\n",
      " [ 7.25254280e-01  4.02108837e+00]]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7fd8f87d25b0>]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAbW0lEQVR4nO3df5BlZX3n8fcXWuhuYYTszO5M1N5hN6xKkWDsJlqpLNjB3UWxih/ris5I3MSt+bVZ2SUWYqxWGaASibHiJmPjlEvQkBUtGEd3oomG6chSEZ2eLD8lyZKBwVlawJhEhJliG77543Y7t2/37XvuPc8553nO+byqbvXc07fvfc69d77nOd/n+zzH3B0REUnPCVU3QEREBqMALiKSKAVwEZFEKYCLiCRKAVxEJFFDZb7Y2rVrfePGjWW+pIhI8g4ePPh9d1/Xub3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zzewMMzsJeAfw5Y7HfBn4pYVR2zcA/+Duc2U3NLCe+21mY8Ae4IrEe2Hteu63u5/h7hvdfSNwO7Aj8eAN2b7nXwL+tZkNmdko8Hrg4ZLbGVqW/X6c1lkHZvbPgFcBh0ptZTWCxrVKeuDuPm9mvwr8Ca0R65vd/SEz27bw+5toVSK8BXgEeI7WETtpGff7Q8A/AT650Bud98RXbsu437WTZb/d/WEz+2PgfuBF4NPuvmIJWioyft7XAbeY2QO00grvd/fkl5g1s88BbwTWmtkR4MPAS6CYuKap9CIiidJMTBGRRCmAi4gkSgFcRCRRCuAiIolSABcRSZQCuIhIohTARUQS9Y8fnYMsfhLwqQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import math\n",
    "\n",
    "np.random.seed(0)\n",
    "\n",
    "data_count = 50\n",
    "w,b = 5,3\n",
    "x1 = np.random.rand(data_count)\n",
    "y1 = w*x1 + b + np.random.rand(data_count)*5\n",
    "\n",
    "x2 = np.random.rand(data_count)\n",
    "y2 = w*x2 + b - np.random.rand(data_count)*5\n",
    "\n",
    "# plt.plot(x1, y1, '*', color='green')\n",
    "# plt.plot(x2, y2, 'x', color='blue')\n",
    "\n",
    "def generate_data_old(w,b,data_count,labels=0):\n",
    "    x = np.random.rand(data_count) \n",
    "    y = (w*x + b + np.random.rand(data_count)*5).reshape((-1, 1))  \n",
    "    label = np.ones_like(y) if labels==1 else np.zeros_like(y) \n",
    "    return np.concatenate((label,np.reshape(x,(-1, 1)),y),axis=1)\n",
    "\n",
    "def generate_data(x,y,data_count,labels=0):\n",
    "    label = np.ones_like(y) if labels==1 else np.zeros_like(y) \n",
    "    return np.concatenate((label,np.reshape(x,(-1, 1)),y),axis=1)\n",
    "\n",
    "#生成数据，第一列为label，值0,1, 第二列x0, 第三列x1\n",
    "data_0 = generate_data(x1,y1.reshape((-1, 1)),data_count,0)\n",
    "data_1 = generate_data(x2,y2.reshape((-1, 1)),data_count,1)\n",
    "data_all = np.concatenate((data_0,data_1),axis=0)\n",
    "np.random.shuffle(data_all)\n",
    "print(data_all)\n",
    "\n",
    "label = data_all[:,0:1]\n",
    "x = data_all[:,1:3]\n",
    "print(label)\n",
    "print(x)\n",
    "\n",
    "plt.plot(x1, y1, '*', color='green')\n",
    "plt.plot(x2, y2, 'x', color='blue')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4478ebd1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "weight (3,) [0 8 2]\n",
      "predict_y: (100,) [1.         1.         1.         1.         1.         1.\n",
      " 1.         0.99951365 1.         1.         1.         1.\n",
      " 1.         1.         1.         1.         1.         1.\n",
      " 1.         1.         0.71904732 1.         1.         1.\n",
      " 1.         1.         1.         1.         0.99975884 1.\n",
      " 1.         1.         1.         1.         1.         1.\n",
      " 1.         1.         1.         1.         1.         1.\n",
      " 0.99999989 1.         1.         1.         1.         1.\n",
      " 1.         0.99998914 1.         1.         0.99999763 1.\n",
      " 1.         1.         1.         1.         1.         1.\n",
      " 1.         1.         1.         1.         0.99998641 1.\n",
      " 1.         1.         0.99999973 1.         1.         1.\n",
      " 1.         1.         1.         0.99999997 1.         0.88847687\n",
      " 1.         1.         1.         1.         1.         0.96239127\n",
      " 1.         0.99999999 0.99999999 1.         1.         1.\n",
      " 1.         1.         1.         1.         1.         1.\n",
      " 1.         1.         1.         1.        ]\n",
      "label: (100, 1) [[1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [0.]\n",
      " [1.]\n",
      " [1.]]\n",
      "0.004871588021542214 8.063919412168438\n",
      "custom_loss: 8.063919412168438\n",
      "log_loss: 17.248925034276766\n"
     ]
    }
   ],
   "source": [
    "weight = np.random.randint(0,10,3) #.reshape((-1, 1)) \n",
    "print(\"weight\", weight.shape,weight)\n",
    "\n",
    "delta = 1e-7\n",
    "\n",
    "learning_rate = 0.05\n",
    "\n",
    "def linear(x):\n",
    "    tmp_x = np.column_stack((x,np.ones(x.shape[0]))) \n",
    "    return np.dot(tmp_x,weight.T) # x*weight\n",
    "\n",
    "def sigmoid(x):\n",
    "    tmp = np.where(x < 0, np.exp(x)/(1 + np.exp(x)), 1/(1 + np.exp(-x))) #数值稳定性\n",
    "#     print(\"tmp:\",tmp)\n",
    "    return 1/(1 + np.exp(-x))\n",
    "\n",
    "def forward(x):\n",
    "    return sigmoid(linear(x))\n",
    "\n",
    "def loss(predict,real_labels):\n",
    "    predict = predict.reshape((-1,1))\n",
    "#     print(\"shape:\",predict.shape,real_labels.shape)\n",
    "    tmp1 = -np.mean(real_labels*np.log(predict+delta))\n",
    "    tmp2 = -np.mean(real_labels*np.log(predict+delta) + (1-real_labels)*np.log(1 - predict + delta) )\n",
    "#     tmp2 = -real_labels*np.log(predict+delta) + (1-real_labels)*np.log(1 - predict+delta) \n",
    "    print(tmp1,tmp2)\n",
    "    return tmp2\n",
    "\n",
    "def back(w,x,y): \n",
    "    \"\"\"更新w,b参数\"\"\"\n",
    "    predict_y = forward(x)\n",
    "#     print(\"predict_y:\",predict_y)\n",
    "#     print(\"y:\",y.reshape((1,-1)))\n",
    "#     print(\"y_shape:\",predict_y.shape,y.shape)\n",
    "    gradient = (predict_y-y.reshape((1,-1)))\n",
    "    tmp_x = np.column_stack((x,np.ones(x.shape[0]))) \n",
    "#     print(\"gradient:\",gradient.shape,x.shape,gradient)\n",
    "    tmp = np.mean(np.dot(gradient,tmp_x),axis=0)\n",
    "#     print(\"tmpxx:\",tmp)\n",
    "    tmp_w = w - learning_rate * tmp \n",
    "    return tmp_w\n",
    "\n",
    "# print(x)\n",
    "# print(linear(x))\n",
    "# print(f(x))\n",
    "# # w0*x + w1* y + w2 = 0\n",
    "# # y= -(w0*x+w2)/w1 = -(w0/w1)*x - (w2/w1)\n",
    "# # w=-(w0/w1), b=-(w2/w1)\n",
    "predict_y = forward(x)\n",
    "print(\"predict_y:\",predict_y.shape,predict_y)\n",
    "print(\"label:\",label.shape,label)\n",
    "# error = loss(predict_y,label)\n",
    "# print(error)\n",
    "\n",
    "\n",
    "\n",
    "from sklearn.metrics import log_loss \n",
    "print(\"custom_loss:\",loss(predict_y,label))\n",
    "print(\"log_loss:\",log_loss(label, predict_y))\n",
    "\n",
    "# y_true = [[0, 1]] \n",
    "# y_pred_1 = [[0.3, 0.7]] \n",
    "# print(\"custom_loss:\",loss(np.array(y_pred_1),np.array(y_true)))\n",
    "# print(\"log_loss:\",log_loss(y_true, y_pred_1))\n",
    "\n",
    "# print(error,-weight[0]/weight[1],-weight[2]/weight[1])\n",
    "\n",
    "# print(back(w,x,label))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d35d6a04",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "weight (3,) [7 8 4] -0.875 -0.5\n",
      "9.6182111115968e-05 8.059144007523663\n",
      "error: 8.059144007523663 17.269884228291197 0.499583666363181 0.1325526266681707\n",
      "7.159146315479762 7.159146265479765\n",
      "error: 7.159146265479765 13.251907552139977 2.960084010402772 1.615208765483043\n",
      "1.0076465294066985 1.007977212388124\n",
      "error: 1.007977212388124 1.0079825187155427 -1.9076813330151978 -1.2535581124132171\n",
      "1.8403363933020333e-05 8.059027929995061\n",
      "error: 8.059027929995061 16.702997936287897 0.4346565545791175 0.17901428403995784\n",
      "7.299700895473851 7.299700845473854\n",
      "error: 7.299700845473854 14.323976004146449 1.2853526892364813 0.813318754907814\n",
      "5.048050693972932 5.048050644306294\n",
      "error: 5.048050644306294 6.572568847084899 -3.789575709464095 -2.9245518909609065\n",
      "2.023699693873547e-06 8.056069903690583\n",
      "error: 8.056069903690583 14.973786918877574 0.4744829428274723 0.27942938194056977\n",
      "7.262870142441921 7.262870092441924\n",
      "error: 7.262870092441924 14.370975649329058 1.1878604363855347 0.8904926605716147\n",
      "5.431809587880056 5.431809537885093\n",
      "error: 5.431809537885093 8.07514785260128 -13.953463498164007 -11.935331821535874\n",
      "6.098399631243477e-07 7.888235875022835\n",
      "error: 7.888235875022835 10.463767366202328 0.5068985654887797 0.3608278133971018\n",
      "7.227677616988746 7.22767756698875\n",
      "error: 7.22767756698875 14.382327156890238 1.124357802658798 0.9392763425301766\n",
      "5.692657247913251 5.692657197913332\n",
      "error: 5.692657197913332 9.170280450703414 13.132641878793192 12.07204928316898\n",
      "1.5942192893872564e-06 5.264219458603369\n",
      "error: 5.264219458603369 5.278858927369828 0.5340427477414167 0.42852015413792877\n",
      "7.193632425194369 7.193632375194373\n",
      "error: 7.193632375194373 14.385157829256473 1.0800340393139065 0.9729537553231613\n",
      "5.8852149457298335 5.8852148957298365\n",
      "error: 5.8852148957298365 9.935948212485155 5.180117221843192 5.022193538106573\n",
      "0.00018097382644812615 0.9414696298900149\n",
      "error: 0.9414696298900149 0.9414711529943542 1.0536083492054564 0.9694871628820628\n",
      "5.987306249630568 5.98730619963057\n",
      "error: 5.98730619963057 10.310882557838733 4.136409103723254 4.072210066798911\n",
      "0.007333883296897449 0.16956096987395156\n",
      "error: 0.16956096987395156 0.16956111882646066 2.3171252836753964 2.2426676028455526\n",
      "2.0194477515947686 2.019455407853962\n",
      "error: 2.019455407853962 2.0659428061172482 -46.23993123338661 -46.154434792449344\n",
      "-4.666381353312312e-08 8.041440439288756\n",
      "error: 8.041440439288756 12.522418735700562 0.7030445489637124 0.6408256311450744\n",
      "6.917639981361382 6.917639931361386\n",
      "error: 6.917639931361386 13.52145483298185 1.4574446081647054 1.4283209635158407\n",
      "4.727480337322943 4.727480287327311\n",
      "error: 4.727480287327311 7.323220711373167 8.197041186935154 8.391699559898\n",
      "6.020201499185206e-08 4.916628729612416\n",
      "error: 4.916628729612416 4.935049766929521 0.6886317912839487 0.6523202598605493\n",
      "6.960391951272681 6.960391901272684\n",
      "error: 6.960391901272684 13.793718002189207 1.2981901858302989 1.3077036434836875\n",
      "5.260951278650932 5.260951228650941\n",
      "error: 5.260951228650941 8.87536530508675 4.3450145428971085 4.554597281357892\n",
      "0.0004313094683358682 0.49454184209334406\n",
      "error: 0.49454184209334406 0.49454253105260115 1.684361293138714 1.725657369060563\n",
      "4.033258897343835 4.033258847514645\n",
      "error: 4.033258847514645 5.886606998715958 7.890457815675558 8.331713353368905\n",
      "-3.2206106982751764e-08 5.397530712513056\n",
      "error: 5.397530712513056 5.466097706778085 0.7639063313976427 0.7566832204648578\n",
      "6.821062849717027 6.821062799717031\n",
      "error: 6.821062799717031 13.449079390957266 1.4019767583322655 1.45642421649252\n",
      "4.960563635104494 4.960563585104519\n",
      "error: 4.960563585104519 8.356105643053706 4.20297745154387 4.503901942051714\n",
      "0.0004452090514766741 0.4455024648193519\n",
      "error: 0.4455024648193519 0.445503302173119 1.895722730333404 1.9953845513989532\n",
      "3.4388961041691863 3.4388960581549757\n",
      "error: 3.4388960581549757 4.675932919178336 7.001325607516998 7.530851057827096\n",
      "-3.986072879273265e-08 4.927566273210992\n",
      "error: 4.927566273210992 4.976442772619504 0.8332169506457586 0.848996356094295\n",
      "6.688921287547745 6.688921237547748\n",
      "error: 6.688921237547748 13.118963841506552 1.496122771343847 1.5850424864897064\n",
      "4.7052547401511 4.705254690151175\n",
      "error: 4.705254690151175 7.8917273969461155 4.102901534498081 4.459931461915763\n",
      "0.0004890052310034837 0.4054396415158882\n",
      "error: 0.4054396415158882 0.40544066831231923 2.093104878855405 2.2421675771692837\n",
      "2.9323402388379862 2.932340254548942\n",
      "error: 2.932340254548942 3.674143531132009 6.599427262525393 7.185326271568869\n",
      "-4.529012525660587e-08 4.772134187514827\n",
      "error: 4.772134187514827 4.829698658114445 0.9126874887036102 0.9484475062141514\n",
      "6.522981551521031 6.522981501521035\n",
      "error: 6.522981501521035 12.695533581047748 1.6323995886530853 1.754614634317556\n",
      "4.324208423025954 4.324208373026942\n",
      "error: 4.324208373026942 7.091130752461858 4.213784312298812 4.624600846133878\n",
      "0.0001042521060006746 0.619859499475746\n",
      "error: 0.619859499475746 0.619862924761337 1.9166111292592038 2.069801338583775\n",
      "3.4699958237237754 3.4699957746824084\n",
      "error: 3.4699957746824084 5.032241019860708 5.037215452516872 5.5303856193267285\n",
      "2.6052470982930184e-07 2.12270601345774\n",
      "error: 2.12270601345774 2.122985971275966 1.4100839169702317 1.5092159743042715\n",
      "5.044663991350396 5.044663941350399\n",
      "error: 5.044663941350399 8.886268030358018 3.15010382411677 3.4504714647083126\n",
      "0.3230482233884929 0.3365477949841413\n",
      "error: 0.3365477949841413 0.3365526318995296 4.882493077132376 5.357463361194593\n",
      "5.042168654508988e-07 1.8691957419535208\n",
      "error: 1.8691957419535208 1.8693605953902608 1.5216036981989478 1.6307285300133272\n",
      "4.703848956511575 4.703848906511582\n",
      "error: 4.703848906511582 8.135439605074964 3.480523377429343 3.8111069472122945\n",
      "0.0723908563506738 0.13117551252669807\n",
      "error: 0.13117551252669807 0.13117568408959165 3.815614077105753 4.167666684492893\n",
      "0.004487867105286279 0.18973271593449847\n",
      "error: 0.18973271593449847 0.1897332022000235 2.927207168408962 3.1733795452780407\n",
      "0.732980535021443 0.7349767168692085\n",
      "error: 0.7349767168692085 0.7354513439446524 5.55677221628875 6.055875897912537\n",
      "-3.5481927819458716e-08 3.2705085015058897\n",
      "error: 3.2705085015058897 3.276168156537996 1.2531835670121636 1.3250681989467645\n",
      "5.642525567155035 5.642525517155039\n",
      "error: 5.642525517155039 10.371956140181 2.437772152643129 2.642518945243099\n",
      "2.0570886185451407 2.057092780230894\n",
      "error: 2.057092780230894 2.307203979764826 5.635569247307652 6.171290276004066\n",
      "-4.46127280031044e-08 3.5994605930462145\n",
      "error: 3.5994605930462145 3.6138370308609797 1.256462487456368 1.3351901670465116\n",
      "5.647226364092705 5.647226314092708\n",
      "error: 5.647226314092708 10.430102007528362 2.3750707458079034 2.58417992733687\n",
      "2.273836891702948 2.2738381534887053\n",
      "error: 2.2738381534887053 2.661237413550954 5.319555740556698 5.848143029099832\n",
      "-3.777925826882967e-08 3.0358822743437686\n",
      "error: 3.0358822743437686 3.040935384544657 1.4001406257109141 1.5012180797320875\n",
      "5.188039539935026 5.188039489935029\n",
      "error: 5.188039489935029 9.371064340716103 2.7396742032340025 2.9983065045170885\n",
      "1.218431207389255 1.2186803277566305\n",
      "error: 1.2186803277566305 1.2531799452840195 5.290860657115886 5.82575039318163\n",
      "-4.113908738980848e-08 3.0650148104601005\n",
      "error: 3.0650148104601005 3.0714284362189357 1.440044103878562 1.5481127702758335\n",
      "5.065720772422417 5.065720722422419\n",
      "error: 5.065720722422419 9.136300039648496 2.790357026415122 3.058914251740583\n",
      "1.1060722409674755 1.1065243651510739\n",
      "error: 1.1065243651510739 1.1282653368845168 5.080606880658862 5.599890250713251\n",
      "-3.018283484890815e-08 2.6541355192981637\n",
      "error: 2.6541355192981637 2.6570133172457577 1.57461829574808 1.6990560581053937\n",
      "4.626833743088174 4.626833693088177\n",
      "error: 4.626833693088177 8.19752728869019 3.11956311120737 3.425831181977421\n",
      "0.4134981208344838 0.4255395853042968\n",
      "error: 0.4255395853042968 0.42557394873488763 4.59234630604077 5.052223876993704\n",
      "5.549971857767091e-07 1.5713551736586544\n",
      "error: 1.5713551736586544 1.5715554860768748 1.8265891387553486 1.9734210085863246\n",
      "3.928046304181027 3.9280462541827608\n",
      "error: 3.9280462541827608 6.5192110187418075 3.696293260587025 4.051710689590477\n",
      "0.01275618276444635 0.15213282073901968\n",
      "error: 0.15213282073901968 0.15213334463049275 3.3022198838747774 3.6030184760645683\n",
      "0.20767437857718765 0.23817059698826504\n",
      "error: 0.23817059698826504 0.23817210139144904 4.0667527623338495 4.435653516461103\n",
      "0.00015107751347290474 0.4713713916759542\n",
      "error: 0.4713713916759542 0.4713774148734883 2.4556316833404677 2.651146131166905\n",
      "2.1771475210133566 2.177149146577281\n",
      "error: 2.177149146577281 2.56549273822595 4.898593041326203 5.336120866458106\n",
      "9.703730332869576e-10 2.2296784269831407\n",
      "error: 2.2296784269831407 2.2309152110567743 1.7485583349233924 1.8678604137973542\n",
      "4.205082492995185 4.205082442995249\n",
      "error: 4.205082442995249 7.194507384746175 3.445046335917208 3.737694205855842\n",
      "0.11137715884509461 0.16434303574006834\n",
      "error: 0.16434303574006834 0.16434332090254689 3.864279585475076 4.186295410491721\n",
      "0.0021655599915887678 0.23114374667895263\n",
      "error: 0.23114374667895263 0.23114514103974057 3.0101902453502642 3.2392781920723714\n",
      "0.711056882405812 0.7139969853084064\n",
      "error: 0.7139969853084064 0.7150812048268311 4.868698585131976 5.260115890804037\n",
      "1.1542946612294763e-08 2.132101171183087\n",
      "error: 2.132101171183087 2.133137292552824 1.8061127168872044 1.9141279697558384\n",
      "4.0799601380276345 4.079960088027819\n",
      "error: 4.079960088027819 6.916128047001691 3.523127045355372 3.7909166391288425\n",
      "0.07823097340465587 0.14358486848067822\n",
      "error: 0.14358486848067822 0.1435850890768885 3.803464105509001 4.084661783308864\n",
      "0.005822119419978581 0.17638570596841194\n",
      "error: 0.17638570596841194 0.17638650138395218 3.221566554774778 3.4414022887595515\n",
      "0.3546807935749031 0.36908898945870405\n",
      "error: 0.36908898945870405 0.3691075083679804 4.423441392934896 4.732260804665427\n",
      "3.6157558353757897e-06 1.0613799125925327\n",
      "error: 1.0613799125925327 1.061436090336742 2.0644659516789847 2.175589504592536\n",
      "3.4044062304449807 3.4044061805866153\n",
      "error: 3.4044061805866153 5.272353777042765 4.01350717885984 4.283081930411892\n",
      "0.0004386912587985339 0.3377685215751759\n",
      "error: 0.3377685215751759 0.3377717878743247 2.8035123358265808 2.967155497868312\n",
      "1.2998242708507906 1.2999549889146629\n",
      "error: 1.2999549889146629 1.3653974656603083 4.941065455982435 5.26217909947265\n",
      "-1.5779597204685e-08 2.2461803564836527\n",
      "error: 2.2461803564836527 2.247747038653337 1.8366246402254525 1.9184884934214426\n",
      "4.0612397359192 4.061239685919333\n",
      "error: 4.061239685919333 6.905483000579193 3.5045892347784027 3.717028983658478\n",
      "0.10602282796295592 0.1594771007820789\n",
      "error: 0.1594771007820789 0.15947737178941782 3.8920189563862895 4.122242797013388\n",
      "0.002598352266606779 0.21020791595309277\n",
      "error: 0.21020791595309277 0.21020913743335093 3.144566147009266 3.310494513119977\n",
      "0.539704081502445 0.54559596155468\n",
      "error: 0.54559596155468 0.5458061839048406 4.741410945803629 5.007733994520845\n",
      "1.2994612327318373e-07 1.7394910546198097\n",
      "error: 1.7394910546198097 1.739918791347518 1.9537824806378392 2.0264044801759384\n",
      "3.7695674066091454 3.7695673566114305\n",
      "error: 3.7695673566114305 6.247953208419871 3.6876873250522753 3.879513438209053\n",
      "0.03228024010423227 0.12679834474590876\n",
      "error: 0.12679834474590876 0.12679863122746254 3.6602992751616394 3.839760355569167\n",
      "0.04291743609145802 0.12662415103108557\n",
      "error: 0.12662415103108557 0.12662439325744512 3.7325664012972672 3.905864471969684\n",
      "0.023425555010609042 0.12801260119080832\n",
      "error: 0.12801260119080832 0.12801293092418106 3.60260956856977 3.757813263774169\n",
      "0.0717204615038591 0.13643742337794337\n",
      "error: 0.13643742337794337 0.13643763080916071 3.8573469803315508 4.016283671663146\n",
      "0.00643431444076507 0.16127151035841894\n",
      "error: 0.16127151035841894 0.16127216698488891 3.356135099572899 3.4777920409651646\n",
      "0.268120827604348 0.2876801327048338\n",
      "error: 0.2876801327048338 0.287685301855753 4.245648323132509 4.403139935035545\n",
      "4.6809185476502496e-05 0.5625606121181641\n",
      "error: 0.5625606121181641 0.5625706327788125 2.491948885531333 2.5565262187862285\n",
      "2.3761489226542682 2.376149128215332\n",
      "error: 2.376149128215332 2.968538717780234 4.701071917608063 4.87257862292352\n",
      "2.9760195285742573e-07 1.5279666727764427\n",
      "error: 1.5279666727764427 1.5282068027455578 2.0260908825581403 2.0633845949670024\n",
      "3.6540062641085256 3.6540062141141503\n",
      "error: 3.6540062141141503 5.9727134910669335 3.7620760959754858 3.8856326511494794\n",
      "0.02284392106705901 0.1255845488759462\n",
      "error: 0.1255845488759462 0.1255848662593388 3.6368755127778067 3.744686762253885\n",
      "0.0685475216248521 0.13314512066662829\n",
      "error: 0.13314512066662829 0.1331453225942307 3.87882198365303 3.986771692525087\n",
      "0.006812644659035497 0.15476754166985573\n",
      "error: 0.15476754166985573 0.1547681396223844 3.4139145678928413 3.4930661578358713\n",
      "0.23616153872871629 0.2583450762539575\n",
      "error: 0.2583450762539575 0.2583480549825199 4.192163231645331 4.291697365888432\n",
      "0.00012080540196740667 0.4292538939837972\n",
      "error: 0.4292538939837972 0.4292592477710955 2.7258712185156257 2.7644886987325625\n",
      "1.7673804280542194 1.7673879524235305\n",
      "error: 1.7673879524235305 1.980260036173854 4.906274293390683 5.017552293934522\n",
      "1.6679341884953153e-08 1.9349405367901824\n",
      "error: 1.9349405367901824 1.935704699766043 2.007515614880206 2.0144927468312073\n",
      "3.760708996141417 3.7607089461427523\n",
      "error: 3.7607089461427523 6.2605872020133 3.695635359310928 3.7639622171842015\n",
      "0.05294735409536015 0.12469610689410132\n",
      "error: 0.12469610689410132 0.1246963105347324 3.8536696493432565 3.9170798966526483\n",
      "0.012132514054880007 0.1338128525901635\n",
      "error: 0.1338128525901635 0.13381326732939378 3.5587786254365845 3.603986267175263\n",
      "0.1344652505764001 0.1739907753845567\n",
      "error: 0.1739907753845567 0.1739911840555571 4.036888690722485 4.0854771260582\n",
      "0.00125732599837401 0.22748273352951778\n",
      "error: 0.22748273352951778 0.2274840861370483 3.198931005859681 3.2167690319911206\n",
      "0.6230870974803429 0.6259214962568035\n",
      "error: 0.6259214962568035 0.6265017839912731 4.862820846675806 4.9114428403415\n",
      "6.444015335436846e-08 1.756126630685009\n",
      "error: 1.756126630685009 1.7565987047394627 2.0625664558371652 2.0449331165344526\n",
      "3.6704284463025907 3.670428396305438\n",
      "error: 3.670428396305438 6.041881828096798 3.756264929253685 3.7791158955614805\n",
      "0.03988562420868806 0.11861465718527608\n",
      "error: 0.11861465718527608 0.11861487175676994 3.82789910565804 3.8425573846833996\n",
      "0.021295858582228995 0.11984991104812544\n",
      "error: 0.11984991104812544 0.11985019642798538 3.706383053301927 3.7096531259870043\n",
      "0.0639613416308979 0.1264802699289982\n",
      "error: 0.1264802699289982 0.12648045817399697 3.9347724109897935 3.931729021382727\n",
      "0.006963550129638491 0.14437532911977502\n",
      "error: 0.14437532911977502 0.14437582557577044 3.5149043318316817 3.4974693526007266\n",
      "0.19726821829885666 0.22220715404116187\n",
      "error: 0.22220715404116187 0.22220856798948155 4.169497438181029 4.150108966360705\n",
      "0.0003316338826449954 0.30958350553504344\n",
      "error: 0.30958350553504344 0.30958597377840513 3.030769981737234 2.992993448244734\n",
      "1.0908451153974548 1.0910537393849904\n",
      "error: 1.0910537393849904 1.1211949570525777 4.860713197719631 4.830766845601826\n",
      "1.0363006251047643e-07 1.646547829597116\n",
      "error: 1.646547829597116 1.6468915099307477 2.113567478932148 2.0624483706476053\n",
      "3.606078124774817 3.606078074779307\n",
      "error: 3.606078074779307 5.884623440761441 3.8266360072589114 3.789556448520635\n",
      "0.028449945734338615 0.11457707039316016\n",
      "error: 0.11457707039316016 0.1145773016012776 3.8022833567856233 3.755979764401089\n",
      "0.03721938016201652 0.11432404440138581\n",
      "error: 0.11432404440138581 0.1143242475451928 3.8624015886632015 3.806962757750939\n",
      "0.02203877748106272 0.11494061519649755\n",
      "error: 0.11494061519649755 0.11494086751721679 3.7650419819026686 3.7007136209007805\n",
      "0.05481038559344009 0.11888839163888287\n",
      "error: 0.11888839163888287 0.11888857110882553 3.951460584102326 3.877229053944808\n",
      "0.009040354739219093 0.13058661133429472\n",
      "error: 0.13058661133429472 0.13058699179774055 3.6164664848812005 3.5352515520736545\n",
      "0.14608350419813224 0.1782863517468342\n",
      "error: 0.1782863517468342 0.17828684784422877 4.136773608417186 4.043006260550544\n",
      "0.0008600625098594504 0.23073784798628352\n",
      "error: 0.23073784798628352 0.2307390965210388 3.259473735456276 3.1647717884827555\n",
      "0.6450054693012939 0.6468592865247095\n",
      "error: 0.6468592865247095 0.6475980051327004 4.938749116714428 4.819357357589302\n",
      "5.939814039048634e-08 1.7078138515837091\n",
      "error: 1.7078138515837091 1.7082140520974576 2.1431963029895114 2.0524898880708373\n",
      "3.6028867762527073 3.602886726256312\n",
      "error: 3.602886726256312 5.883219638601322 3.857915083305295 3.751254747550821\n",
      "0.03029784014684177 0.11034255935382414\n",
      "error: 0.11034255935382414 0.11034276454809583 3.8639695025329965 3.748382286701209\n",
      "0.02994908296746481 0.10972912299094678\n",
      "error: 0.10972912299094678 0.10972932623930215 3.867941794715995 3.7434789111704814\n",
      "0.030186720122606335 0.10911929522685151\n",
      "error: 0.10911929522685151 0.10911949505015293 3.875671448140788 3.742277066554156\n",
      "0.029367351910282117 0.10851421974037204\n",
      "error: 0.10851421974037204 0.1085144189492011 3.8765307916689102 3.734367306840175\n",
      "0.030473518500215114 0.107917754776169\n",
      "error: 0.107917754776169 0.10791794860608799 3.889849950604596 3.7386396472836374\n",
      "0.028115938789856333 0.10734245817374342\n",
      "error: 0.10734245817374342 0.10734265530548966 3.880458110103393 3.720801397698057\n",
      "0.03210456084790094 0.10683103173036508\n",
      "error: 0.10683103173036508 0.10683121725270803 3.9122468818831853 3.7430082703049044\n",
      "0.024827098316851797 0.10651573877735018\n",
      "error: 0.10651573877735018 0.1065159400559424 3.8689769489352424 3.692431689244072\n",
      "0.03870886161314348 0.10687587305633225\n",
      "error: 0.10687587305633225 0.10687604467354533 3.961010469066083 3.7728076619518895\n",
      "0.01654426874307187 0.10917550869466014\n",
      "error: 0.10917550869466014 0.10917573996801924 3.806539487829812 3.615147040275596\n",
      "0.06793755237151432 0.1188811879587985\n",
      "error: 0.1188811879587985 0.11888135421418726 4.081846985131243 3.8717728940266767\n",
      "0.00427686129175493 0.14162888835721052\n",
      "error: 0.14162888835721052 0.14162930546052516 3.600593154899182 3.4003133473622182\n",
      "0.2167492747658198 0.23345780729465737\n",
      "error: 0.23345780729465737 0.23345976009868752 4.337500395095647 4.100980251746009\n",
      "0.00015669363102004864 0.3395415149217193\n",
      "error: 0.3395415149217193 0.3395438581526475 3.0400990749183596 2.8494448872465297\n",
      "1.3119279854612063 1.3119641320885416\n",
      "error: 1.3119641320885416 1.384508560222173 4.999372239754641 4.724495195669317\n",
      "8.190760027202663e-08 1.6229438788848196\n",
      "error: 1.6229438788848196 1.6232294672635257 2.213784595214281 2.0527323210218658\n",
      "3.546026218413975 3.546026168418653\n",
      "error: 3.546026168418653 5.730059540278562 3.9833198657086037 3.752962467917296\n",
      "0.016599198150113993 0.10665986301957192\n",
      "error: 0.10665986301957192 0.10666008330428578 3.8393125813924924 3.607100444422084\n",
      "0.06343823790398312 0.11477128263956252\n",
      "error: 0.11477128263956252 0.11477144343243591 4.094722615744648 3.842175426975292\n",
      "0.004818909894799289 0.13400635218526266\n",
      "error: 0.13400635218526266 0.13400672241146178 3.6568374711559555 3.417124048550804\n",
      "0.18781411643767168 0.20724551573903202\n",
      "error: 0.20724551573903202 0.20724661579767 4.309242551024781 4.030078783186247\n",
      "0.00029695359226965197 0.2768109885990737\n",
      "error: 0.2768109885990737 0.2768124957045038 3.2150579886980863 2.9838741965183364\n",
      "0.9453912685939733 0.9456334552468283\n",
      "error: 0.9456334552468283 0.9569709312421931 5.009679267432445 4.680963406749769\n",
      "9.210434161540172e-08 1.5787030993052884\n",
      "error: 1.5787030993052884 1.5789557891622257 2.252965622235184 2.0659830940774833\n",
      "3.496897621526011 3.496897571532321\n",
      "error: 3.496897571532321 5.608025628115654 4.044978435072333 3.7691883296004063\n",
      "0.010698389770811422 0.1113195036299967\n",
      "error: 0.1113195036299967 0.11131975493506548 3.800617690905713 3.5301736845977087\n",
      "0.09633666477473563 0.1340752569185108\n",
      "error: 0.1340752569185108 0.13407546530215297 4.194990411709222 3.8942563369996654\n",
      "0.0016775712818663502 0.16986205718449324\n",
      "error: 0.16986205718449324 0.16986263279546587 3.5450288649268433 3.2737113661917285\n",
      "0.33156236276370377 0.3384283927039802\n",
      "error: 0.3384283927039802 0.3384433329037631 4.603776982187475 4.2641496314216525\n",
      "9.686122611781757e-06 0.6709645224781073\n",
      "error: 0.6709645224781073 0.6709757570482059 2.6527363759966542 2.42690923271585\n",
      "2.4993538106713795 2.4993537864988755\n",
      "error: 2.4993537864988755 3.2709340344016793 4.750678634478469 4.402547233862242\n",
      "1.7670685129230223e-06 0.965311742842976\n",
      "error: 0.965311742842976 0.9653472976798458 2.503493361441378 2.286689905084754\n",
      "2.8860289229357345 2.8860288741541753\n",
      "error: 2.8860288741541753 4.126498988969703 4.536380380908102 4.202554647569933\n",
      "1.9388008554717225e-05 0.558650243753271\n",
      "error: 0.558650243753271 0.558657725558776 2.766533772085037 2.5345893332159646\n",
      "2.213090123452529 2.2130902520598372\n",
      "error: 2.2130902520598372 2.6982777073250697 4.83503735450075 4.480113376818731\n",
      "6.283252767222272e-07 1.1553868586898814\n",
      "error: 1.1553868586898814 1.1554602640260094 2.434697698871109 2.220973310945864\n",
      "3.0828392916968745 3.0828392419168176\n",
      "error: 3.0828392419168176 4.612495774729135 4.410774663409734 4.082894640475268\n",
      "8.92303314018401e-05 0.36877692447883476\n",
      "error: 0.36877692447883476 0.3687799630098332 3.069203060627224 2.8162024198269795\n",
      "1.3768453516155679 1.376864793436947\n",
      "error: 1.376864793436947 1.4733322678893648 4.92843092448938 4.560349034818886\n",
      "1.9979898889520025e-07 1.369040190384435\n",
      "error: 1.369040190384435 1.3691958559786805 2.372954283892066 2.1589513594957603\n",
      "3.2570807418533256 3.257080691893478\n",
      "error: 3.257080691893478 5.052325153703952 4.242813758454115 3.918727782840022\n",
      "0.0009096186924909713 0.1960091419525505\n",
      "error: 0.1960091419525505 0.19600998154748153 3.508100779989693 3.221976868658751\n",
      "0.4109455121815405 0.415131679580621\n",
      "error: 0.415131679580621 0.4151874267525949 4.70004595993195 4.333051839327945\n",
      "2.6812051771950203e-06 0.8557024586260101\n",
      "error: 0.8557024586260101 0.8557298706213605 2.6103253701867164 2.375025475795147\n",
      "2.6541250858822667 2.654125041626837\n",
      "error: 2.654125041626837 3.6522712831894824 4.562644272004874 4.205888593352305\n",
      "1.309997635061292e-05 0.5943636803752882\n",
      "error: 0.5943636803752882 0.5943736071894206 2.7812926635581507 2.5355677961922423\n",
      "2.223985240834911 2.2239853297790955\n",
      "error: 2.2239853297790955 2.7408416449388486 4.75738726439624 4.38528263183903\n",
      "1.2624849690943647e-06 0.982430722865789\n",
      "error: 0.982430722865789 0.9824770918735055 2.568535568757119 2.335073973016551\n",
      "2.7699623453002453 2.7699622973643305\n",
      "error: 2.7699622973643305 3.9198305464662657 4.469079339497185 4.117136809863555\n",
      "4.072686558815393e-05 0.4406478573184122\n",
      "error: 0.4406478573184122 0.4406529100475809 2.9878273420055046 2.7268105932997924\n",
      "1.6470371803277457 1.6470410698000981\n",
      "error: 1.6470410698000981 1.842290109252493 4.908707595315438 4.52127480047821\n",
      "1.9657578577762978e-07 1.3255290562353652\n",
      "error: 1.3255290562353652 1.3256861464787368 2.4395687258679786 2.211314013210946\n",
      "3.124370054639274 3.124370004734503\n",
      "error: 3.124370004734503 4.77295985139219 4.29628144975154 3.9505150579793273\n",
      "0.00044254113803705186 0.2322980102825387\n",
      "error: 0.2322980102825387 0.23229930458466555 3.4452838538532613 3.1484669785792505\n",
      "0.5504474067875995 0.5522638827106143\n",
      "error: 0.5522638827106143 0.5526361236163921 4.848365254755222 4.452267614858387\n",
      "4.0400721120361007e-07 1.1750375875799783\n",
      "error: 1.1750375875799783 1.1751364259509638 2.5176060317195366 2.2778162744477237\n",
      "2.935510636632438 2.93551058706626\n",
      "error: 2.93551058706626 4.325004305234199 4.368433935413177 4.006612163643965\n",
      "0.00016598718294929453 0.29762794183376484\n",
      "error: 0.29762794183376484 0.29763017815425113 3.2971948632517205 3.0021065914113185\n",
      "0.8984835363750915 0.8987455313328978\n",
      "error: 0.8987455313328978 0.9102339765445429 4.897458346546074 4.486968504489642\n",
      "2.1420730582137704e-07 1.2813351606309644\n",
      "error: 1.2813351606309644 1.281481537784702 2.491475770467533 2.2476899495008342\n",
      "3.021779878181837 3.021779828369067\n",
      "error: 3.021779828369067 4.549584832438311 4.321439981769634 3.953035977465167\n",
      "0.00034102152135218083 0.24413416736340007\n",
      "error: 0.24413416736340007 0.244135657754469 3.440993380696376 3.127867864879349\n",
      "0.5878837373719318 0.5892939541493228\n",
      "error: 0.5892939541493228 0.5899133747365256 4.861925540716199 4.441918998891465\n",
      "3.295072779017023e-07 1.1884961761433146\n",
      "error: 1.1884961761433146 1.1886070597080993 2.5468717167132295 2.292943395172204\n",
      "2.892020119949471 2.892020070456921\n",
      "error: 2.892020070456921 4.244972780985291 4.350136149386298 3.9691294877401533\n",
      "0.00023670113125940758 0.2659890873127801\n",
      "error: 0.2659890873127801 0.265990908207224 3.399095970823807 3.080827520331694\n",
      "0.6940958575903059 0.6948600763547916\n",
      "error: 0.6948600763547916 0.6968590848588349 4.905613905848364 4.471033510619433\n",
      "1.8464153171821598e-07 1.2817607485042144\n",
      "error: 1.2817607485042144 1.2819175664897184 2.5254030123186 2.2670318541138896\n",
      "2.9654268620380497 2.9654268122839587\n",
      "error: 2.9654268122839587 4.433257111045697 4.312757692109953 3.924395596420031\n",
      "0.00043306356924649437 0.2255912215464205\n",
      "error: 0.2255912215464205 0.22559251924022297 3.5137306260831918 3.1787067656039527\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.4737275065875377 0.47636597081594984\n",
      "error: 0.47636597081594984 0.47653516808684077 4.720260064255245 4.288198778097451\n",
      "1.8562070520147944e-06 0.8552456034532498\n",
      "error: 0.8552456034532498 0.8552806555413924 2.721811760041283 2.4423766396192934\n",
      "2.4829264951989707 2.482926458004126\n",
      "error: 2.482926458004126 3.340287554344671 4.557293621580388 4.1382567802556\n",
      "1.4338781876287702e-05 0.5375775381437405\n",
      "error: 0.5375775381437405 0.5375870747674255 2.944910774637525 2.6477116827175777\n",
      "1.8904548235348728 1.8904555068953701\n",
      "error: 1.8904555068953701 2.2194376525066546 4.765134215795241 4.3256891542259535\n",
      "1.0050170108810337e-06 0.9531981613725616\n",
      "error: 0.9531981613725616 0.9532513113414438 2.6950611601825165 2.4154197566582645\n",
      "2.558595096474692 2.558595052880178\n",
      "error: 2.558595052880178 3.5161127874486744 4.497691867656634 4.080149748787622\n",
      "3.120329968148774e-05 0.4380878654085021\n",
      "error: 0.4380878654085021 0.4380938828118889 3.093292489773149 2.7814814317066965\n",
      "1.4849068309572786 1.4849142324238955\n",
      "error: 1.4849142324238955 1.6370211044870873 4.7647812994484635 4.320126816166285\n",
      "9.661185696819768e-07 0.9514160497618264\n",
      "error: 0.9514160497618264 0.9514709295455945 2.709429471800284 2.4256744024486427\n",
      "2.533833948332173 2.5338339056561243\n",
      "error: 2.5338339056561243 3.470496231596118 4.497082050868032 4.0744226770050895\n",
      "3.118905245138279e-05 0.4343156396093881\n",
      "error: 0.4343156396093881 0.4343217239607832 3.111895507899219 2.7949984138972943\n",
      "1.4485673047514218 1.4485762465639476\n",
      "error: 1.4485762465639476 1.589870562966838 4.744181978564994 4.295645880991994\n",
      "1.2064107684322592e-06 0.904529968562832\n",
      "error: 0.904529968562832 0.9045776597404841 2.7414342284158812 2.451971413714433\n",
      "2.4661436649739494 2.4661436269380217\n",
      "error: 2.4661436269380217 3.3295505588037195 4.5170909006443365 4.086987434908722\n",
      "2.350081136394838e-05 0.4624137548735122\n",
      "error: 0.4624137548735122 0.46242104116987887 3.0813273462146733 2.763154091688416\n",
      "1.54280462457901 1.5428095595028515\n",
      "error: 1.5428095595028515 1.722066294648271 4.742980317709704 4.289059724894129\n",
      "1.1815428375865446e-06 0.899995375987675\n",
      "error: 0.899995375987675 0.9000439914022845 2.7562092602207815 2.4623615364865126\n",
      "2.440710837879685 2.440710801672891\n",
      "error: 2.440710801672891 3.280503327093562 4.513955462132937 4.078633089086657\n",
      "2.4411127878925924e-05 0.45401497271105545\n",
      "error: 0.45401497271105545 0.4540221550127193 3.1060770860891864 2.782039244198182\n",
      "1.4896077020940606 1.489614297335566\n",
      "error: 1.489614297335566 1.6505115258492964 4.71955412149138 4.261716893001563\n",
      "1.5533728355680398e-06 0.846207982047528\n",
      "error: 0.846207982047528 0.8462488305802548 2.790361093920213 2.4902945761205446\n",
      "2.368223262463737 2.3682232358192463\n",
      "error: 2.3682232358192463 3.1280562826969613 4.527821818892018 4.0851372896900795\n",
      "2.0106610884949776e-05 0.4723769446544798\n",
      "error: 0.4723769446544798 0.47238507481650077 3.0912617572518095 2.764359843968535\n",
      "1.5423636345374323 1.5423682762743365\n",
      "error: 1.5423682762743365 1.7264551209999015 4.713687262607071 4.250278243845655\n",
      "1.6385981153430751e-06 0.8300473346246968\n",
      "error: 0.8300473346246968 0.8300869322507017 2.809305854545401 2.5040479082057394\n",
      "2.332939065638075 2.332939044811062\n",
      "error: 2.332939044811062 3.0572369900066696 4.5265135489504615 4.0778504623109955\n",
      "2.0517664821668935e-05 0.4659534101966972\n",
      "error: 0.4659534101966972 0.46596148294119827 3.112195943929575 2.779287113079935\n",
      "1.4996649772325283 1.4996708094571793\n",
      "error: 1.4996708094571793 1.6689164394676128 4.695116869661975 4.226892857856091\n",
      "2.060907503335812e-06 0.7858199780654901\n",
      "error: 0.7858199780654901 0.7858541849703268 2.8406553370923553 2.5288846631203823\n",
      "2.2667107218718705 2.2667107181697417\n",
      "error: 2.2667107181697417 2.9179760540434034 4.5349654140935245 4.079022884311435\n",
      "1.83260600130115e-05 0.47506616929088713\n",
      "error: 0.47506616929088713 0.47507484360463437 3.1106312123682427 2.7734279451294297\n",
      "1.5170794830609637 1.5170845587455557\n",
      "error: 1.5170845587455557 1.6954525348115297 4.685565942318702 4.211622224799655\n",
      "2.3168890606799116e-06 0.7606168649808839\n",
      "error: 0.7606168649808839 0.760648624747411 2.864284284139251 2.546467125168639\n",
      "2.218708636761162 2.2187086498510147\n",
      "error: 2.2187086498510147 2.8233706408753676 4.5393183039739435 4.076458151328898\n",
      "1.736594795466219e-05 0.47735135348264185\n",
      "error: 0.47735135348264185 0.4773603375700332 3.1185809586613322 2.7762065431972083\n",
      "1.509124888951965 1.5091300504684333\n",
      "error: 1.5091300504684333 1.68637198670538 4.6741635265194725 4.194574172855623\n",
      "2.686343909922212e-06 0.7312480695702099\n",
      "error: 0.7312480695702099 0.7312769617359184 2.890863248768053 2.566585024320928\n",
      "2.1616461063320305 2.1616461471172483\n",
      "error: 2.1616461471172483 2.7152781955050154 4.550131474583013 4.0796599118674335\n",
      "1.5018746647411105e-05 0.49049314232647423\n",
      "error: 0.49049314232647423 0.4905029745710312 3.1116281099095455 2.7654115520513103\n",
      "1.5407326452901262 1.5407367529672038\n",
      "error: 1.5407367529672038 1.7331763445093396 4.666951183094618 4.181472815003069\n",
      "2.951018923900674e-06 0.7108514247473318\n",
      "error: 0.7108514247473318 0.7108786426318044 2.9134652564201295 2.58306773429691\n",
      "2.113372840592497 2.113372911706681\n",
      "error: 2.113372911706681 2.629174861661482 4.561221826437303 4.083241253345384\n",
      "1.2915004350544275e-05 0.504581633298558\n",
      "error: 0.504581633298558 0.5045924354519747 3.1040902132463 2.7542138086781267\n",
      "1.5740282289150052 1.574031460349008\n",
      "error: 1.574031460349008 1.782951867767748 4.6607064459326555 4.169413518127982\n",
      "3.203584108785184e-06 0.6926680089050933\n",
      "error: 0.6926680089050933 0.6926938549838882 2.935404450047873 2.598970060721804\n",
      "2.065448012670578 2.065448122284363\n",
      "error: 2.065448122284363 2.5473453220510587 4.574534544966434 4.088955072773144\n",
      "1.0735071857415449e-05 0.5231608231531287\n",
      "error: 0.5231608231531287 0.5231729484026565 3.0919002715366997 2.7389378036535006\n",
      "1.6203548896942837 1.6203572313711176\n",
      "error: 1.6203572313711176 1.8521958819557662 4.6569159554333925 4.15976483344509\n",
      "3.3624386619637657e-06 0.6798174370048742\n",
      "error: 0.6798174370048742 0.6798425281467647 2.954469707859657 2.6123151680588577\n",
      "2.0244813408325193 2.0244814903447157\n",
      "error: 2.0244814903447157 2.480385097781123 4.585480776409441 4.092678744342065\n",
      "9.210000746551052e-06 0.5381217317140692\n",
      "error: 0.5381217317140692 0.5381350878950393 3.085143586925702 2.728713430258809\n",
      "1.6520789538577767 1.6520808091135604\n",
      "error: 1.6520808091135604 1.9009651294038976 4.650932699921496 4.148260356303351\n",
      "3.642035260105879e-06 0.6625903311807773\n",
      "error: 0.6625903311807773 0.6626142148287336 2.976955733371939 2.628770862745317\n",
      "1.9727816919338153 1.9727819075865387\n",
      "error: 1.9727819075865387 2.397384159732666 4.6006777638031044 4.100291945548239\n",
      "7.419746750600698e-06 0.5615105159103444\n",
      "error: 0.5615105159103444 0.5615258202631227 3.070274365904076 2.711252207484989\n",
      "1.7070975573105185 1.707098824462613\n",
      "error: 1.707098824462613 1.9848641002090344 4.646937409931651 4.138694417704959\n",
      "3.83712495103241e-06 0.6496560070113995\n",
      "error: 0.6496560070113995 0.6496791568876173 2.997006116428492 2.6430499766851\n",
      "1.9274556586292675 1.9274559468113381\n",
      "error: 1.9274559468113381 2.32694695962675 4.610706489282982 4.103346873099592\n",
      "6.426678486031001e-06 0.5757897603208783\n",
      "error: 0.5757897603208783 0.5758065329217512 3.0663075499317705 2.7037215296666197\n",
      "1.7314548516681691 1.7314558972808762\n",
      "error: 1.7314558972808762 2.0240603298303306 4.63840663704433 4.125102256620762\n",
      "4.320854297135001e-06 0.6275900981514705\n",
      "error: 0.6275900981514705 0.6276116148098745 3.024763423412911 2.6642433160561443\n",
      "1.8591159180290022 1.859116362632266\n",
      "error: 1.859116362632266 2.2214859782636815 4.6230822964697404 4.108473528718779\n",
      "5.379740561679574e-06 0.5948713389584727\n",
      "error: 0.5948713389584727 0.5948901121348544 3.0584695996774225 2.692707841104109\n",
      "1.7671054963205313 1.767106296257682\n",
      "error: 1.767106296257682 2.0808049832064475 4.629540001028754 4.111236498979763\n",
      "4.904943896692995e-06 0.6050306434668309\n",
      "error: 0.6050306434668309 0.6050505428786324 3.054387439928402 2.6870382770768533\n",
      "1.785491448268644 1.7854921438887479\n",
      "error: 1.7854921438887479 2.110316634855637 4.624552654680048 4.103782299810593\n",
      "5.278316551870553e-06 0.592679693463296\n",
      "error: 0.592679693463296 0.592698707479742 3.0707401755040893 2.699765225413172\n",
      "1.744583382861272 1.7445842722643252\n",
      "error: 1.7445842722643252 2.0493558774895133 4.61996682772359 4.096630599000184\n",
      "5.659011900695696e-06 0.5810683750136413\n",
      "error: 0.5810683750136413 0.5810865775170548 3.0867712849322455 2.7121364591252215\n",
      "1.70505518043396 1.7050563058825625\n",
      "error: 1.7050563058825625 1.9910391117559363 4.6123984454355815 4.086754992032253\n",
      "6.353725610874106e-06 0.5636826914217551\n",
      "error: 0.5636826914217551 0.5636996147522491 3.109034529836277 2.7300293320203366\n",
      "1.6486454241740867 1.6486470110168818\n",
      "error: 1.6486470110168818 1.9081333632602777 4.60134027595709 4.073660952932453\n",
      "7.539699604083265e-06 0.5397917618511022\n",
      "error: 0.5397917618511022 0.5398069543719566 3.1393904211187946 2.755059109272207\n",
      "1.5716266103205216 1.5716291688795747\n",
      "error: 1.5716291688795747 1.795955908193022 4.591549956917766 4.061489133557423\n",
      "8.826773999368519e-06 0.5184128399877433\n",
      "error: 0.5184128399877433 0.5184265805747864 3.1685976233928237 2.7788545225179386\n",
      "1.5000780722650773 1.5000820676725763\n",
      "error: 1.5000820676725763 1.6931837238787997 4.591973252723038 4.05812266184401\n",
      "8.909095971941573e-06 0.5154395357036433\n",
      "error: 0.5154395357036433 0.5154531379983722 3.17647111775971 2.7833117579344755\n",
      "1.485725376947807 1.485729688942943\n",
      "error: 1.485729688942943 1.6732852203477835 4.592010005320344 4.054353263500361\n",
      "9.052823437819486e-06 0.5116783671776676\n",
      "error: 0.5116783671776676 0.5116917721753779 3.185298307289988 2.7885674716390776\n",
      "1.4689978573797093 1.469002583581672\n",
      "error: 1.469002583581672 1.65003670592585 4.592971956171926 4.051330179266784\n",
      "9.081248834468638e-06 0.5094821008130568\n",
      "error: 0.5094821008130568 0.5094954113183136 3.192211868284554 2.7920473695062498\n",
      "1.4573714245126177 1.457376435983174\n",
      "error: 1.457376435983174 1.6341024363026428 4.593687964184633 4.048038214484956\n",
      "9.150358983670353e-06 0.506766708123858\n",
      "error: 0.506766708123858 0.5067798846986047 3.199754523648405 2.796042365427983\n",
      "1.4441912670618495 1.444196634738263\n",
      "error: 1.444196634738263 1.6159926599486247 4.595029381252967 4.045238997755848\n",
      "9.140832630124977e-06 0.5050875224649111\n",
      "error: 0.5050875224649111 0.5051006316489128 3.20600603229419 2.798831560612054\n",
      "1.4344353434818817 1.434440965804636\n",
      "error: 1.434440965804636 1.6027608825999295 4.596061500345574 4.042122960100195\n",
      "9.179797571886693e-06 0.5027879875818159\n",
      "error: 0.5027879875818159 0.5028009838630932 3.213017134583564 2.8022575963626837\n",
      "1.4227764233363238 1.4227823852320631\n",
      "error: 1.4227823852320631 1.58686753455182 4.597699894085027 4.03948743366978\n",
      "9.141177399636757e-06 0.5014950523498102\n",
      "error: 0.5014950523498102 0.5015080002768854 3.2187607124185313 2.804506054595433\n",
      "1.4144519360783594 1.4144581219196084\n",
      "error: 1.4144581219196084 1.575690503502427 4.598882148824617 4.036413053387231\n",
      "9.17074834045101e-06 0.4993304984023061\n",
      "error: 0.4993304984023061 0.49934333618995447 3.225584672671369 2.807681074094252\n",
      "1.403392662339169 1.4033991950355946\n",
      "error: 1.4033991950355946 1.5606970145532253 4.600801551700652 4.033935329383412\n",
      "9.103972626965114e-06 0.4984068187472437\n",
      "error: 0.4984068187472437 0.4984196266426049 3.230837175462865 2.809412367767954\n",
      "1.3964321816161205 1.396438898506254\n",
      "error: 1.396438898506254 1.551458907761421 4.602006166910566 4.030799575773769\n",
      "9.140551359884897e-06 0.4961624768572062\n",
      "error: 0.4961624768572062 0.4961751636322111 3.237743876300788 2.8125838391475226\n",
      "1.3852605300378227 1.3852676271916484\n",
      "error: 1.3852676271916484 1.5363642967028381 4.604247994854126 4.028521338199817\n",
      "9.039236186522311e-06 0.49568956613886167\n",
      "error: 0.49568956613886167 0.49570224730826795 3.2423986353781253 2.8137096993284607\n",
      "1.379921565213252 1.3799287844224057\n",
      "error: 1.3799287844224057 1.5294031569190534 4.605330944276749 4.025206388239729\n",
      "9.101698882337608e-06 0.4931213685267175\n",
      "error: 0.4931213685267175 0.49313390199449686 3.2496999328054303 2.8171598639670914\n",
      "1.3678269286121352 1.3678346005718478\n",
      "error: 1.3678346005718478 1.5130866452197478 4.60800571833681 4.023227350476742\n",
      "8.950410439015278e-06 0.4933001033492614\n",
      "error: 0.4933001033492614 0.49331266902980536 3.253497228165153 2.8174554254452464\n",
      "1.3647622521297575 1.3647699399181819\n",
      "error: 1.3647699399181819 1.5092815121323229 4.608765361230853 4.019565783688406\n",
      "9.065442580992043e-06 0.4900629690386448\n",
      "error: 0.4900629690386448 0.4900753383567465 3.261638216609844 2.821582618134055\n",
      "1.3505989927207447 1.3506072710074701\n",
      "error: 1.3506072710074701 1.490178925917513 4.612082245254413 4.0180689695708125\n",
      "8.835819457827298e-06 0.4912652425267078\n",
      "error: 0.4912652425267078 0.49127770638073287 3.264096758281147 2.8206270366859525\n",
      "1.3510284671924893 1.351036574824447\n",
      "error: 1.351036574824447 1.491174924109288 4.612210536279404 4.0138027436122945\n",
      "9.044274437223682e-06 0.4868288605060684\n",
      "error: 0.4868288605060684 0.48684104549318824 3.2737656717784196 2.826042493882245\n",
      "1.3330349518118267 1.3330438994132543\n",
      "error: 1.3330438994132543 1.466903190270944 4.616526996088203 4.013096557778068\n",
      "8.688712407497085e-06 0.4896840066629511\n",
      "error: 0.4896840066629511 0.4896963894043246 3.2740689159684995 2.8231200654280952\n",
      "1.3390327150112558 1.3390411656640404\n",
      "error: 1.3390411656640404 1.4754895287139456 4.615542376822907 4.007820633238639\n",
      "9.054385127657431e-06 0.4832173513583406\n",
      "error: 0.4832173513583406 0.4832293200327136 3.2863499122264077 2.8307815338108364\n",
      "1.3144433622894136 1.3144530929436307\n",
      "error: 1.3144530929436307 1.4423357840488913 4.621441045056626 4.008403681064185\n",
      "8.496491435222697e-06 0.4887457418525271\n",
      "error: 0.4887457418525271 0.48875807709004276 3.283170789345995 2.8247294261168983\n",
      "1.3293809831672547 1.3293896545250978\n",
      "error: 1.3293896545250978 1.4630284528144886 4.618590414086226 4.001483775074858\n",
      "9.119036947913775e-06 0.47894896357214145\n",
      "error: 0.47894896357214145 0.4789606678902592 3.2997685081244637 2.8361365987536895\n",
      "1.2938585201199515 1.2938692339373137\n",
      "error: 1.2938692339373137 1.415209941159437 4.626998935483324 4.004145799434111\n",
      "8.239072165872708e-06 0.48877067460318663\n",
      "error: 0.48877067460318663 0.48878301752637704 3.2909968728309114 2.825108596442004\n",
      "1.3230936320752065 1.3231023338624428\n",
      "error: 1.3231023338624428 1.4551572035822102 4.621104561092077 3.994590063300549\n",
      "9.274605539403049e-06 0.4736136431682759\n",
      "error: 0.4736136431682759 0.4736250122652579 3.314588384109081 2.842608544513581\n",
      "1.2698424827445534 1.269854536265126\n",
      "error: 1.269854536265126 1.3836732651588477 4.633497353683579 4.000582241353538\n",
      "7.885445129735715e-06 0.4903016995821129\n",
      "error: 0.4903016995821129 0.49031414236425186 3.2968741196866778 2.82367971754364\n",
      "1.3218721052938414 1.3218805509935445\n",
      "error: 1.3218805509935445 1.4541784473818902 4.622688368880299 3.986816161462169\n",
      "9.584113341825856e-06 0.4665673732813934\n",
      "error: 0.4665673732813934 0.46657830211893037 3.3317268797158106 2.851002737563597\n",
      "1.2400872369841236 1.2401012989221016\n",
      "error: 1.2401012989221016 1.3448077168007613 4.64148089691623 3.998185636876374\n",
      "7.385143180015914e-06 0.4943450444820069\n",
      "error: 0.4943450444820069 0.49435775001432974 3.2995944768295336 2.8194039536135587\n",
      "1.3287813801483153 1.3287891503123088\n",
      "error: 1.3287891503123088 1.4643076362932548 4.62262882735967 3.9775780347885834\n",
      "1.0174969874930545e-05 0.4566733161917238\n",
      "error: 0.4566733161917238 0.45668364300450665 3.3528635092633587 2.8627892908595336\n",
      "1.2004054103345543 1.200422880477886\n",
      "error: 1.200422880477886 1.2934177061173309 4.652132750021181 3.9979835413300364\n",
      "6.643887748165611e-06 0.5031300021238859\n",
      "error: 0.5031300021238859 0.503143298503608 3.296602573268567 2.8100836067696444\n",
      "1.3503306171739564 1.3503371075001396\n",
      "error: 1.3503371075001396 1.4946963794353936 4.619345837245385 3.965578036857019\n",
      "1.137579071665372e-05 0.4414799818399461\n",
      "error: 0.4414799818399461 0.44148943114131556 3.3817802779886175 2.88127617971446\n",
      "1.141471173853975 1.1414956940204488\n",
      "error: 1.1414956940204488 1.2181482136281152 4.668777575988555 4.00287340022288\n",
      "5.451170002509163e-06 0.5231149758381973\n",
      "error: 0.5231149758381973 0.5231297140473693 3.2810430150871928 2.7898248710052704\n",
      "1.4041245968921785 1.404128970595305\n",
      "error: 1.404128970595305 1.5708406745667407 4.608116169419455 3.9469102248964285\n",
      "1.4433555399595976e-05 0.41396723275718306\n",
      "error: 0.41396723275718306 0.4139752368566587 3.4300094320629557 2.9165378304643164\n",
      "1.0351332847935761 1.0351796485843443\n",
      "error: 1.0351796485843443 1.0858008336474498 4.703881158168582 4.0237407021820495\n",
      "3.364907548285029e-06 0.5799920719612568\n",
      "error: 0.5799920719612568 0.5800116471437269 3.230521352914784 2.739382746202765\n",
      "1.549866180407472 1.5498677615055323\n",
      "error: 1.5498677615055323 1.782791638151702 4.5734118114503906 3.9085438112355884\n",
      "2.6777793540179366e-05 0.3538964861455573\n",
      "error: 0.3538964861455573 0.35390188604649475 3.536713130225732 3.002642074594499\n",
      "0.7854188716579616 0.7856255911746409\n",
      "error: 0.7856255911746409 0.7973677583356323 4.761404392893396 4.064356991547633\n",
      "1.4753768476167356e-06 0.688918895959592\n",
      "error: 0.688918895959592 0.6889514011074772 3.1557861607837787 2.668416576557471\n",
      "1.7692719178938543 1.7692722435294959\n",
      "error: 1.7692722435294959 2.116514919611188 4.562975804186542 3.8912332046481968\n",
      "3.36553987724045e-05 0.33233963568542413\n",
      "error: 0.33233963568542413 0.3323442621740165 3.5834612827296466 3.0366213262863666\n",
      "0.6862556235381713 0.6866206921799519\n",
      "error: 0.6866206921799519 0.6915959015905777 4.735611824039686 4.033322216990127\n",
      "2.2913201705066728e-06 0.6231145478508134\n",
      "error: 0.6231145478508134 0.6231386416912921 3.2096534947403503 2.7091436919425598\n",
      "1.6338667894259438 1.6338676086137023\n",
      "error: 1.6338676086137023 1.909912597036536 4.559593821930416 3.879793587378332\n",
      "3.792223105690506e-05 0.32056019916135337\n",
      "error: 0.32056019916135337 0.32056442240065697 3.61261326849704 3.0550756588610715\n",
      "0.6314968897453234 0.6319935900717765\n",
      "error: 0.6319935900717765 0.6348394533972996 4.7083596651214545 4.00091979539452\n",
      "3.6848684397457287e-06 0.5569163845468835\n",
      "error: 0.5569163845468835 0.5569338325372548 3.275909695658592 2.760122726517382\n",
      "1.471428353973313 1.4714307358842311\n",
      "error: 1.4714307358842311 1.6707340676420304 4.596267199188543 3.902005143658911\n",
      "2.223021714377522e-05 0.36235160784444626\n",
      "error: 0.36235160784444626 0.362357294606036 3.542331591704813 2.987264090251276\n",
      "0.8093613861097358 0.8095232522610196\n",
      "error: 0.8095232522610196 0.8240178281000569 4.764927984193296 4.040444186681317\n",
      "1.6294025319849985e-06 0.6620993038971693\n",
      "error: 0.6620993038971693 0.6621281178799967 3.196953625358657 2.685940643375846\n",
      "1.696984499573514 1.6969849800454972\n",
      "error: 1.6969849800454972 2.0077419911087295 4.55562650451725 3.8592505646465383\n",
      "4.617588830792032e-05 0.30127922727603695\n",
      "error: 0.30127922727603695 0.30128283285628127 3.664012530702761 3.085665589822093\n",
      "0.5439714167142031 0.5447946946113396\n",
      "error: 0.5447946946113396 0.5458245508402814 4.6514302236851695 3.934179019422715\n",
      "1.0192407902399857e-05 0.4328275422877518\n",
      "error: 0.4328275422877518 0.43283636728849856 3.4407845383737885 2.8887540548242288\n",
      "1.0804834265229777 1.0805119110284587\n",
      "error: 1.0805119110284587 1.1434944947018217 4.699120646370331 3.96951157808924\n",
      "4.9748618888035855e-06 0.511098902138741\n",
      "error: 0.511098902138741 0.5111125474647504 3.343440260226345 2.8015266821170326\n",
      "1.332510047776951 1.3325154957535543\n",
      "error: 1.3325154957535543 1.4748431884192865 4.637931180621479 3.9137236191375235\n",
      "1.3489229408819677e-05 0.4016609541978472\n",
      "error: 0.4016609541978472 0.401668216948159 3.494469433585263 2.928007812168525\n",
      "0.9608592860241297 0.9609176123814887\n",
      "error: 0.9609176123814887 0.9978515961359429 4.7416960427852715 3.9964405923297592\n",
      "2.72210654286842e-06 0.5826891078025914\n",
      "error: 0.5826891078025914 0.5827087030046674 3.278200942558644 2.7391508697922897\n",
      "1.5144650308367784 1.514466567571501\n",
      "error: 1.514466567571501 1.736224885352128 4.591578098129805 3.8663857509648647\n",
      "3.0539493927067595e-05 0.32692947788133075\n",
      "error: 0.32692947788133075 0.3269338145623062 3.6297390834639343 3.0374936928034213\n",
      "0.6467496668210795 0.6471379361283109\n",
      "error: 0.6471379361283109 0.6506450727046047 4.722228524716597 3.9711739064904163\n",
      "3.901890921961062e-06 0.5336063921335688\n",
      "error: 0.5336063921335688 0.5336216453573003 3.3330882593999194 2.7799034101730866\n",
      "1.3852793375245407 1.3852828812256477\n",
      "error: 1.3852828812256477 1.5501116286766452 4.629726826530054 3.889577038310933\n",
      "1.7461542014050088e-05 0.3720343521023877\n",
      "error: 0.3720343521023877 0.372040293858004 3.5554776060734556 2.966980804077827\n",
      "0.8353431927464873 0.8354608201032288\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "error: 0.8354608201032288 0.8534507537671913 4.771729378841013 4.004285310782727\n",
      "1.9115503650536594e-06 0.6221853423341284\n",
      "error: 0.6221853423341284 0.6222089483621844 3.260325586732754 2.711692876901619\n",
      "1.5888895134100065 1.5888903599414133\n",
      "error: 1.5888903599414133 1.8480089953758891 4.574433615708198 3.8351663518288737\n",
      "4.6391229821161596e-05 0.2912139347069369\n",
      "error: 0.2912139347069369 0.2912171745062594 3.7132693363849074 3.0953660118189568\n",
      "0.49435588893099386 0.49536243443997174\n",
      "error: 0.49536243443997174 0.4959134812234177 4.619743076060559 3.8664632847689857\n",
      "2.3181817368545477e-05 0.3433844854126499\n",
      "error: 0.3433844854126499 0.34338928371053534 3.6146875089876906 3.0059300588075275\n",
      "0.7128344455476423 0.7130691805419035\n",
      "error: 0.7130691805419035 0.7199536981842312 4.756851885344484 3.976447709185669\n",
      "2.6905367052652238e-06 0.5716743417396997\n",
      "error: 0.5716743417396997 0.5716925512105068 3.3134277085379407 2.7462748593786155\n",
      "1.470552714010791 1.4705545065891448\n",
      "error: 1.4705545065891448 1.6741811343049722 4.614031127568389 3.8535770453118894\n",
      "2.709478913068878e-05 0.3282668264188854\n",
      "error: 0.3282668264188854 0.328271104395472 3.648739070493376 3.0284568194288086\n",
      "0.6456738023309492 0.6460200372804217\n",
      "error: 0.6460200372804217 0.6495795140029794 4.7277956613403695 3.943453522692463\n",
      "4.49265368811966e-06 0.5050117736989533\n",
      "error: 0.5050117736989533 0.5050246192053458 3.388631527659138 2.8039311685711854\n",
      "1.2906399957317338 1.2906457813488694\n",
      "error: 1.2906457813488694 1.4198466415880204 4.6620542261823985 3.8845036306940606\n",
      "1.322057625030403e-05 0.3885327321262565\n",
      "error: 0.3885327321262565 0.3885391969746258 3.5504167105490048 2.9378961634000054\n",
      "0.89338516320787 0.8934574529445483\n",
      "error: 0.8934574529445483 0.9197742492965253 4.772632365537513 3.97212268487482\n",
      "2.3615508708469184e-06 0.5814158447526371\n",
      "error: 0.5814158447526371 0.5814348281591508 3.3191319881070873 2.7387946571518134\n",
      "1.4820372982225982 1.4820388260514008\n",
      "error: 1.4820388260514008 1.6923424963023113 4.615064340424997 3.8375487795108416\n",
      "3.0403953723543404e-05 0.3146681606094445\n",
      "error: 0.3146681606094445 0.3146719782753829 3.687076697872167 3.047426249706139\n",
      "0.5840351814832502 0.5845190327783147\n",
      "error: 0.5845190327783147 0.5863157498490412 4.694499888931765 3.8979955863226734\n",
      "8.666354464839508e-06 0.42619088945857064\n",
      "error: 0.42619088945857064 0.42619899630037117 3.5029519937258473 2.8875141578287513\n",
      "1.0301353620125875 1.0301643910726324\n",
      "error: 1.0301643910726324 1.082882132788686 4.736470476234049 3.9281576304327888\n",
      "4.591550099391429e-06 0.4943534593633916\n",
      "error: 0.4943534593633916 0.49436542083599133 3.418037143404891 2.812444310674311\n",
      "1.24906497250626 1.249071868086228\n",
      "error: 1.249071868086228 1.3645088829942986 4.6776802376052435 3.8751649844296283\n",
      "1.2149233880888899e-05 0.38980601340698995\n",
      "error: 0.38980601340698995 0.38981243087562595 3.5641802298405083 2.9323642501447362\n",
      "0.8914645016168978 0.8915311256221637\n",
      "error: 0.8915311256221637 0.9179017102112023 4.778613707706667 3.95434961748067\n",
      "2.513604765526737e-06 0.5645501778199841\n",
      "error: 0.5645501778199841 0.5645674022298981 3.3521400814928795 2.7506200824933456\n",
      "1.4299850716200004 1.429987037828\n",
      "error: 1.429987037828 1.6182092937119963 4.6375716247338366 3.834177502291823\n",
      "2.4931653036105334e-05 0.3244749606435587\n",
      "error: 0.3244749606435587 0.32447901026400716 3.683356623155908 3.026562809036813\n",
      "0.6202221175991545 0.6205722665842474\n",
      "error: 0.6205722665842474 0.6233625964621852 4.720754494178326 3.8977092366415067\n",
      "6.682869321992964e-06 0.44625641886403566\n",
      "error: 0.44625641886403566 0.44626542799795 3.4913436700841127 2.8612369789620358\n",
      "1.090787431016096 1.0908053367539197\n",
      "error: 1.0908053367539197 1.1590028764126759 4.7230832168932215 3.8950079811685967\n",
      "6.661984851028449e-06 0.4450562686273207\n",
      "error: 0.4450562686273207 0.44506518502899683 3.4963037343249437 2.86194415756978\n",
      "1.0851270528971648 1.0851452534543198\n",
      "error: 1.0851452534543198 1.1519868202546273 4.726285253637817 3.8930389499625955\n",
      "6.548318207584921e-06 0.4453720325587518\n",
      "error: 0.4453720325587518 0.44538093619824004 3.4992203072355164 2.8609438287276148\n",
      "1.0845303531802077 1.084548260100517\n",
      "error: 1.084548260100517 1.1513532813081497 4.72790658932265 3.8897812104660376\n",
      "6.601476665346487e-06 0.4429817183829655\n",
      "error: 0.4429817183829655 0.4429904681663792 3.505748814159983 2.8629714496692387\n",
      "1.0749378866731203 1.0749565553024607\n",
      "error: 1.0749565553024607 1.1394091970895706 4.732374885441315 3.888878604013773\n",
      "6.35711718749918e-06 0.44550550642551573\n",
      "error: 0.44550550642551573 0.44551435829680064 3.5056861770685 2.8594951796739156\n",
      "1.08170803327213 1.0817255504195114\n",
      "error: 1.0817255504195114 1.1480329059975771 4.731661327039278 3.8837307188318566\n",
      "6.652963354091115e-06 0.43913309981499826\n",
      "error: 0.43913309981499826 0.4391415949655855 3.5175380791856226 2.8659713754373\n",
      "1.0588581148131335 1.0588780025676732\n",
      "error: 1.0588780025676732 1.1195118726060813 4.740407667908472 3.8863654897263475\n",
      "5.979501133722217e-06 0.44907153674358063\n",
      "error: 0.44907153674358063 0.4490805166219021 3.5075782711684624 2.8542675464447806\n",
      "1.0901801927819517 1.090196125243272\n",
      "error: 1.090196125243272 1.158952178197502 4.731885352491509 3.8748517546795287\n",
      "7.095663908460617e-06 0.42937722117440025\n",
      "error: 0.42937722117440025 0.42938517858318465 3.5374298288918964 2.875727754934543\n",
      "1.0226055784078942 1.0226296794349286\n",
      "error: 1.0226296794349286 1.0748312736412426 4.7550956348632365 3.889373391118373\n",
      "5.051755310864065e-06 0.4645253531754747\n",
      "error: 0.4645253531754747 0.4645351123496735 3.494407168318503 2.8365868127543217\n",
      "1.1361017612462694 1.1361131233638893\n",
      "error: 1.1361131233638893 1.2178045179695425 4.721318314406825 3.857303161774415\n",
      "9.011126350071042e-06 0.4022453177054601\n",
      "error: 0.4022453177054601 0.4022519962448596 3.5829300169070097 2.9067883710597\n",
      "0.9227063173898137 0.9227498573716226\n",
      "error: 0.9227498573716226 0.9550488287295967 4.786579428037136 3.9063218229982044\n",
      "3.2613520158667814e-06 0.5119731802744313\n",
      "error: 0.5119731802744313 0.5119858143054321 3.4462468843784535 2.790116026229577\n",
      "1.26991867719405 1.269923192898676\n",
      "error: 1.269923192898676 1.39571467557567 4.693327950021481 3.8262847268966356\n",
      "1.5191404242289511e-05 0.3511372976957524\n",
      "error: 0.3511372976957524 0.35114201299745423 3.67144306880453 2.9738953311585097\n",
      "0.7194512764660306 0.7196002984034585\n",
      "error: 0.7196002984034585 0.7275758984575285 4.776719187356487 3.889764690505903\n",
      "4.058364690961018e-06 0.48326647396984207\n",
      "error: 0.48326647396984207 0.4832771976339877 3.4846651611932895 2.8157386229118653\n",
      "1.1856696071186825 1.1856772014770085\n",
      "error: 1.1856772014770085 1.2829745227702571 4.714178060216129 3.8345762326822586\n",
      "1.15424024707969e-05 0.3733386394491769\n",
      "error: 0.3733386394491769 0.3733440957954047 3.639985568595106 2.9410194074088802\n",
      "0.8068066807357791 0.8068897942523376\n",
      "error: 0.8068897942523376 0.8229764291716204 4.798656580199458 3.8990688717797757\n",
      "3.0461064875162974e-06 0.513917932642044\n",
      "error: 0.513917932642044 0.5139305522213228 3.4572426078817986 2.7867839394928597\n",
      "1.2671952377196625 1.2671994852559032\n",
      "error: 1.2671994852559032 1.392804640148749 4.69948007942828 3.8145851600319993\n",
      "1.567784629899774e-05 0.3436504370119283\n",
      "error: 0.3436504370119283 0.34365484734388585 3.696119948625149 2.9810931415462867\n",
      "0.6852615990768937 0.6854341523571454\n",
      "error: 0.6854341523571454 0.6912974835916649 4.766890529841555 3.8646448936124935\n",
      "5.401307491732912e-06 0.44555879213802263\n",
      "error: 0.44555879213802263 0.445567306741548 3.5435834081087534 2.8516750147295467\n",
      "1.063529224214433 1.0635448090486175\n",
      "error: 1.0635448090486175 1.126490777565957 4.754050047964531 3.8498442244933235\n",
      "6.8754079553586325e-06 0.4186799766231584\n",
      "error: 0.4186799766231584 0.4186871859446397 3.5831391127785035 2.8809397321152064\n",
      "0.9717054264413537 0.9717329174880259\n",
      "error: 0.9717329174880259 1.0138052333729564 4.7839589475070925 3.869788515228978\n",
      "4.38032558839639e-06 0.46565638569907736\n",
      "error: 0.46565638569907736 0.4656658992300774 3.524643783720518 2.8295901513841972\n",
      "1.1233524484462079 1.1233626028444463\n",
      "error: 1.1233626028444463 1.2026721851060307 4.738829146516445 3.828950640398019\n",
      "9.422424935018248e-06 0.38472782871264466\n",
      "error: 0.38472782871264466 0.3847335918003351 3.6395275560870153 2.9207303407904446\n",
      "0.8447132305198055 0.8447718698618952\n",
      "error: 0.8447718698618952 0.8658020989310167 4.8065582424709365 3.8795431397435927\n",
      "3.25021883605687e-06 0.49692779520139946\n",
      "error: 0.49692779520139946 0.4969390738496447 3.4948726337690386 2.79882456149257\n",
      "1.2103261765939914 1.2103316778056676\n",
      "error: 1.2103316778056676 1.3169741503318437 4.720092925068473 3.8056811229285747\n",
      "1.3697119020882537e-05 0.3481073547569338\n",
      "error: 0.3481073547569338 0.3481118085469339 3.7055644751045778 2.968570503230872\n",
      "0.6984975270276357 0.6986396030534145\n",
      "error: 0.6986396030534145 0.7054240023353043 4.777689636996531 3.8475762225010466\n",
      "5.526891690114693e-06 0.43460691825572945\n",
      "error: 0.43460691825572945 0.4346147242858091 3.576336313281731 2.859152123705573\n",
      "1.0196199911985815 1.0196383749522526\n",
      "error: 1.0196383749522526 1.0724864472047912 4.776458544681602 3.8423043590377137\n",
      "5.826192356679309e-06 0.4276252077942219\n",
      "error: 0.4276252077942219 0.42763266369107744 3.588791994914525 2.8661046224913984\n",
      "0.9949389657351938 0.9949600753792425\n",
      "error: 0.9949600753792425 1.0423635215596763 4.785300541251456 3.845179841509533\n",
      "5.214287829908227e-06 0.43798114825468515\n",
      "error: 0.43798114825468515 0.43798906135957516 3.578023165071334 2.854094751990837\n",
      "1.0278862846817516 1.0279030457285425\n",
      "error: 1.0279030457285425 1.082865125045885 4.776584021931164 3.8339093061973495\n",
      "6.2076543849167925e-06 0.41825193027197505\n",
      "error: 0.41825193027197505 0.4182589192186287 3.607748437653995 2.8751314974668505\n",
      "0.9602921030416809 0.9603174087131521\n",
      "error: 0.9603174087131521 1.0006955807684652 4.797436946727081 3.8464823735759195\n",
      "4.569576864228319e-06 0.4494220550562627\n",
      "error: 0.4494220550562627 0.4494304713345141 3.5694352465576493 2.8407250264799995\n",
      "1.0615932641212604 1.0616062270015287\n",
      "error: 1.0616062270015287 1.1250494463049288 4.768790347626055 3.819246825092417\n",
      "7.528935370279608e-06 0.3961001036383874\n",
      "error: 0.3961001036383874 0.3961061343671651 3.645588677693172 2.8995318904242073\n",
      "0.8788236569266169 0.8788643284350891\n",
      "error: 0.8788643284350891 0.905173189078337 4.813822436133884 3.8512525156683486\n",
      "3.738824532946315e-06 0.46888447574270065\n",
      "error: 0.46888447574270065 0.4688938428182508 3.551816611513519 2.8201153013469766\n",
      "1.1177130780712037 1.1177217204426706\n",
      "error: 1.1177217204426706 1.196603722079156 4.754850162103724 3.7998498536321526\n",
      "1.0116432819209534e-05 0.3654490288713278\n",
      "error: 0.3654490288713278 0.36545390993585114 3.6991295671236752 2.936689035608546\n",
      "0.7606089547299731 0.7606913607799917\n",
      "error: 0.7606913607799917 0.7725989685317687 4.804874645671893 3.8356062261943635\n",
      "4.615112718603775e-06 0.44277184133558883\n",
      "error: 0.44277184133558883 0.4427798135636344 3.5898165065333685 2.844634592294013\n",
      "1.0354470041867503 1.0354611980209936\n",
      "error: 1.0354611980209936 1.0927482898718583 4.782622361995887 3.813636276572248\n",
      "6.852592109068997e-06 0.40026094305970294\n",
      "error: 0.40026094305970294 0.40026704599122803 3.650919891276099 2.8910075782043454\n",
      "0.8899185694532628 0.8899537068164582\n",
      "error: 0.8899537068164582 0.9181984490908296 4.817423869337687 3.8373569955990114\n",
      "4.013705724516812e-06 0.4552801115878362\n",
      "error: 0.4552801115878362 0.4552886407069749 3.5801775861599543 2.8305979906663334\n",
      "1.0715441624006066 1.0715549625273324\n",
      "error: 1.0715549625273324 1.1381467510023089 4.774307641460293 3.7988083484305117\n",
      "8.387037719256083e-06 0.37803116204225545\n",
      "error: 0.37803116204225545 0.3780363987232133 3.6902240291659596 2.916493696683872\n",
      "0.8055629150518105 0.8056204344029639\n",
      "error: 0.8056204344029639 0.8224045522122045 4.817518519512197 3.8291150334405493\n",
      "4.275553148095527e-06 0.44556870617775113\n",
      "error: 0.44556870617775113 0.44557669846300824 3.5981034179694875 2.8388469450360376\n",
      "1.0390941663276188 1.0391069869657168\n",
      "error: 1.0391069869657168 1.097625693950016 4.78708174769979 3.8007540963060067\n",
      "7.260861356475308e-06 0.3894316758369897\n",
      "error: 0.3894316758369897 0.3894372813628562 3.67832166066115 2.900478135021947\n",
      "0.8463992126576746 0.8464420265302214\n",
      "error: 0.8464420265302214 0.8684736627446905 4.823077878365947 3.825327011588904\n",
      "4.164323440417115e-06 0.4457083851040969\n",
      "error: 0.4457083851040969 0.4457163275659301 3.6037969587704732 2.837253583067791\n",
      "1.0369666036700858 1.0369791047466155\n",
      "error: 1.0369791047466155 1.0951472722246003 4.7904931034808165 3.7953349405027725\n",
      "7.327287151849913e-06 0.386035791819641\n",
      "error: 0.386035791819641 0.3860412333383784 3.6890462321201802 2.902819475609346\n",
      "0.8319786427271584 0.8320237933576828\n",
      "error: 0.8320237933576828 0.8522243514646902 4.824283492574339 3.8180959414875315\n",
      "4.3537573162354975e-06 0.43816784536057546\n",
      "error: 0.43816784536057546 0.43817538057538863 3.6191336858110863 2.8434223996064127\n",
      "1.0108291103050577 1.0108433454521846\n",
      "error: 1.0108433454521846 1.062967425556801 4.800942582713835 3.7955191789552982\n",
      "6.5848186907690185e-06 0.3940118197255487\n",
      "error: 0.3940118197255487 0.39401751133148954 3.6826754529888084 2.891410303156596\n",
      "0.8593386918893975 0.8593752724590757\n",
      "error: 0.8593752724590757 0.8834098673303701 4.827412918047175 3.812471259022248\n",
      "4.408892963776733e-06 0.434134197854857\n",
      "error: 0.434134197854857 0.43414149864343443 3.630073011007043 2.84607460376486\n",
      "0.9955406504974534 0.995555760490014\n",
      "error: 0.995555760490014 1.0443809792828502 4.807841329334245 3.7929455286197613\n",
      "6.269633073841762e-06 0.3963693128681841\n",
      "error: 0.3963693128681841 0.3963750506993732 3.684779509083676 2.8868867243047616\n",
      "0.8658992530804476 0.8659330455397698\n",
      "error: 0.8659330455397698 0.8910212297496923 4.829448391880934 3.8060304757266903\n",
      "4.544007532750676e-06 0.4282621601401171\n",
      "error: 0.4282621601401171 0.4282691530891187 3.6434145950059658 2.8506595323197357\n",
      "0.974219464616119 0.9742361333164294\n",
      "error: 0.9742361333164294 1.0186138336293182 4.815868618548247 3.7913017283323898\n",
      "5.857885668225332e-06 0.40066178130850666\n",
      "error: 0.40066178130850666 0.4006676382376465 3.6841095874226983 2.880183058793264\n",
      "0.8792385489850182 0.8792684543931907\n",
      "error: 0.8792684543931907 0.9064738677363573 4.831207655311617 3.799430007910134\n",
      "4.703180272242604e-06 0.4220081630637186\n",
      "error: 0.4220081630637186 0.42201484301228015 3.6573323098749033 2.8557102718840297\n",
      "0.9514052683042884 0.9514238268405308\n",
      "error: 0.9514238268405308 0.9913140932428454 4.823379307857908 3.789288142589726\n",
      "5.517994373965433e-06 0.40419398347776236\n",
      "error: 0.40419398347776236 0.4041999319973531 3.6846025530320596 2.8744591923051046\n",
      "0.889670787939761 0.8896977411167367\n",
      "error: 0.8896977411167367 0.918653149614641 4.832796877941354 3.792749511828661\n",
      "4.880743518025879e-06 0.415556156827142\n",
      "error: 0.415556156827142 0.4155625270717566 3.6716026253644545 2.8610421713073926\n",
      "0.9276725363672038 0.9276933142167739\n",
      "error: 0.9276933142167739 0.9632182041789638 4.829889396465103 3.786517919731576\n",
      "5.282878939391547e-06 0.406120482013777\n",
      "error: 0.406120482013777 0.40612646109446776 3.687387957749907 2.8706028093892595\n",
      "weight: 3.687387957749907 2.8706028093892595 0.406120482013777\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7fd8f8b82a90>]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAA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4zuIeWaqc56yq81V1nqrOA/BzAMstDd5Afu/rXwL4cxGpFJFaAJ8FsCXgdnopn3N+H84VB0RkFoAFALYH2srgeRq/jOqBq+qAiHwdwL/CGcV+UFXfFJEbEz+/H05FwvkAtgE4BOdT3Fp5nvOdAI4C8KNEj3RALV7JLc9zLhn5nK+qbhGRfwHwGoAhAD9W1TFL0WyQ52t8D4CHROR1OKmF21TV6iVmReQxAGcBmCEiHwK4C8BEwJ/4xan0RESWMi2FQkREeWIAJyKyFAM4EZGlGMCJiCzFAE5EZCkGcCIiSzGAExFZ6v8DQ+RRKMGnje0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "weight = np.random.randint(0,10,3)\n",
    "print(\"weight\", weight.shape,weight,-weight[0]/weight[1],-weight[2]/weight[1])\n",
    "learning_rate = 0.05\n",
    "\n",
    "for i in range(500):\n",
    "    predict_y = forward(x)\n",
    "    error = loss(predict_y,label)\n",
    "    err2 = log_loss(label, predict_y)\n",
    "    weight = back(weight,x,label) \n",
    "#     if i % 500 == 0:\n",
    "    print(\"error:\",error,err2,-weight[0]/(weight[1]+delta),-weight[2]/(weight[1]+delta))\n",
    "# print(\"error:\",weight,error)\n",
    "pw = -weight[0]/(weight[1]+delta)\n",
    "pb = -weight[2]/(weight[1]+delta)\n",
    "print(\"weight:\",pw,pb,error)\n",
    "\n",
    "plt.plot(x1, y1, '*', color='green')\n",
    "plt.plot(x2, y2, 'x', color='blue')\n",
    "plt.plot([0,1],[pb,pw+pb])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9591eafa",
   "metadata": {},
   "source": [
    "使用pytorch实现"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "4033016d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "torch.Size([100, 2])\n",
      "tensor([[1.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [0.],\n",
      "        [1.],\n",
      "        [1.]])\n",
      "epoch 0, loss 0.9083604216575623\n",
      "epoch 50, loss 0.50760418176651\n",
      "epoch 100, loss 0.4654110372066498\n",
      "epoch 150, loss 0.43191537261009216\n",
      "epoch 200, loss 0.4048268496990204\n",
      "epoch 250, loss 0.38252463936805725\n",
      "epoch 300, loss 0.3638586103916168\n",
      "epoch 350, loss 0.34800294041633606\n",
      "epoch 400, loss 0.334356427192688\n",
      "epoch 450, loss 0.3224736750125885\n",
      "epoch 500, loss 0.3120197355747223\n",
      "epoch 550, loss 0.30273857712745667\n",
      "epoch 600, loss 0.29443156719207764\n",
      "epoch 650, loss 0.28694263100624084\n",
      "epoch 700, loss 0.28014737367630005\n",
      "epoch 750, loss 0.2739456295967102\n",
      "epoch 800, loss 0.26825594902038574\n",
      "epoch 850, loss 0.2630111575126648\n",
      "epoch 900, loss 0.25815579295158386\n",
      "epoch 950, loss 0.2536432445049286\n",
      "epoch 1000, loss 0.24943426251411438\n",
      "epoch 1050, loss 0.24549554288387299\n",
      "epoch 1100, loss 0.24179865419864655\n",
      "epoch 1150, loss 0.23831896483898163\n",
      "epoch 1200, loss 0.23503535985946655\n",
      "epoch 1250, loss 0.23192943632602692\n",
      "epoch 1300, loss 0.22898505628108978\n",
      "epoch 1350, loss 0.22618810832500458\n",
      "epoch 1400, loss 0.22352612018585205\n",
      "epoch 1450, loss 0.22098799049854279\n",
      "epoch 1500, loss 0.2185639590024948\n",
      "epoch 1550, loss 0.21624517440795898\n",
      "epoch 1600, loss 0.2140238732099533\n",
      "epoch 1650, loss 0.2118930220603943\n",
      "epoch 1700, loss 0.20984622836112976\n",
      "epoch 1750, loss 0.2078777700662613\n",
      "epoch 1800, loss 0.20598241686820984\n",
      "epoch 1850, loss 0.20415551960468292\n",
      "epoch 1900, loss 0.20239263772964478\n",
      "epoch 1950, loss 0.20068998634815216\n",
      "epoch 2000, loss 0.19904392957687378\n",
      "epoch 2050, loss 0.1974511593580246\n",
      "epoch 2100, loss 0.19590860605239868\n",
      "epoch 2150, loss 0.19441354274749756\n",
      "epoch 2200, loss 0.1929634064435959\n",
      "epoch 2250, loss 0.19155576825141907\n",
      "epoch 2300, loss 0.19018840789794922\n",
      "epoch 2350, loss 0.18885932862758636\n",
      "epoch 2400, loss 0.18756654858589172\n",
      "epoch 2450, loss 0.18630844354629517\n",
      "epoch 2500, loss 0.1850833147764206\n",
      "epoch 2550, loss 0.18388958275318146\n",
      "epoch 2600, loss 0.18272586166858673\n",
      "epoch 2650, loss 0.1815907508134842\n",
      "epoch 2700, loss 0.18048307299613953\n",
      "epoch 2750, loss 0.17940159142017365\n",
      "epoch 2800, loss 0.1783452183008194\n",
      "epoch 2850, loss 0.1773129105567932\n",
      "epoch 2900, loss 0.17630372941493988\n",
      "epoch 2950, loss 0.17531666159629822\n",
      "epoch 3000, loss 0.17435093224048615\n",
      "epoch 3050, loss 0.17340563237667084\n",
      "epoch 3100, loss 0.1724800318479538\n",
      "epoch 3150, loss 0.17157337069511414\n",
      "epoch 3200, loss 0.17068500816822052\n",
      "epoch 3250, loss 0.16981424391269684\n",
      "epoch 3300, loss 0.16896048188209534\n",
      "epoch 3350, loss 0.1681230664253235\n",
      "epoch 3400, loss 0.16730152070522308\n",
      "epoch 3450, loss 0.16649526357650757\n",
      "epoch 3500, loss 0.16570375859737396\n",
      "epoch 3550, loss 0.16492652893066406\n",
      "epoch 3600, loss 0.16416317224502563\n",
      "epoch 3650, loss 0.16341319680213928\n",
      "epoch 3700, loss 0.16267618536949158\n",
      "epoch 3750, loss 0.16195175051689148\n",
      "epoch 3800, loss 0.16123947501182556\n",
      "epoch 3850, loss 0.16053901612758636\n",
      "epoch 3900, loss 0.15985004603862762\n",
      "epoch 3950, loss 0.1591721922159195\n",
      "epoch 4000, loss 0.1585051417350769\n",
      "epoch 4050, loss 0.15784861147403717\n",
      "epoch 4100, loss 0.15720225870609283\n",
      "epoch 4150, loss 0.1565658152103424\n",
      "epoch 4200, loss 0.1559390276670456\n",
      "epoch 4250, loss 0.1553216576576233\n",
      "epoch 4300, loss 0.15471339225769043\n",
      "epoch 4350, loss 0.1541140228509903\n",
      "epoch 4400, loss 0.1535232961177826\n",
      "epoch 4450, loss 0.1529410183429718\n",
      "epoch 4500, loss 0.1523669809103012\n",
      "epoch 4550, loss 0.15180091559886932\n",
      "epoch 4600, loss 0.1512426882982254\n",
      "epoch 4650, loss 0.15069207549095154\n",
      "epoch 4700, loss 0.1501489281654358\n",
      "epoch 4750, loss 0.14961299300193787\n",
      "epoch 4800, loss 0.14908413589000702\n",
      "epoch 4850, loss 0.1485622376203537\n",
      "epoch 4900, loss 0.14804702997207642\n",
      "epoch 4950, loss 0.1475384682416916\n",
      "epoch 4999, loss 0.14704632759094238\n",
      "weight: 4.169762834794372 3.3381371123473094\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7fd90b972c70>]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAkzklEQVR4nO3de3icVb0v8O8vmebWJDO0CU3amVDKTUrbCTYFNh6FbLwgeOSiAhZQ1POUwvHI2eiDcNyFx7J53KIPW87etdrjQWS7j8DWisqRvUWpVo6CTd1N2lLA0tJ22vRCYSZpkzS3df54J8k0zWQu722td76f5+nTzmQys96Z6e9d72/91lqilAIREZmnzO8GEBFRcRjAiYgMxQBORGQoBnAiIkMxgBMRGSrk5Ys1NDSo+fPne/mSRETG27x581tKqcbJ93sawOfPn4+Ojg4vX5KIyHgismeq+5lCISIyFAM4EZGhGMCJiAzFAE5EZCgGcCIi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WA7jV4B5ZppzHrJQ6Uyk1Xyk1H8CPAdxpaPAG8vte/wzAe0UkJCI1AC4GsMPjdjopn2PeC+uKAyIyB8B5AHZ52krvORq/tOqBK6WGReTzAP4d1ij2Y0qp7SKyMv3z78CqSLgKwE4AfbDO4sbK85jvBzAbwLfTPdJhZfBKbnkec2Dkc7xKqR0i8m8AugCMAvieUmrKUjQT5PkZPwjgcRHZCiu18GWllNFLzIrIjwBcDqBBRBIAHgAwA3AnfnEqPRGRoXRLoRARUZ4YwImIDMUATkRkKAZwIiJDMYATERmKAZyIyFAM4EREhvr//7XbIXaojB0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import torch\n",
    "import torch.nn as nn\n",
    "\n",
    "# 创建一个Logistic回归的模型\n",
    "class LogisticRegressionModel(nn.Module):\n",
    "    def __init__(self, input_dim, output_dim):\n",
    "        super(LogisticRegressionModel, self).__init__()\n",
    "        self.linear = nn.Linear(input_dim, output_dim,bias=True)  \n",
    "\n",
    "    def forward(self, x):\n",
    "        out = torch.sigmoid(self.linear(x))\n",
    "        return out\n",
    "\n",
    "model = LogisticRegressionModel(2, 1) #模型初始化\n",
    "criterion = nn.BCELoss() #定义损失函数\n",
    "optimizer = torch.optim.SGD(model.parameters(), lr=learning_rate) #定义最优化算法\n",
    "\n",
    "inX = torch.as_tensor(x,dtype=torch.float32) #将numpy转成tensor\n",
    "outY = torch.as_tensor(label,dtype=torch.float32).reshape(-1,1)\n",
    "print(inX.shape)\n",
    "print(outY)\n",
    "\n",
    "for epoch in range(5000):  #迭代次数\n",
    "    optimizer.zero_grad() #清理模型里参数的梯度值\n",
    "    predict_Y = model(inX) #根据输入获得当前参数下的输出值\n",
    "    loss = criterion(predict_Y, outY) #计算误差\n",
    "    loss.backward() #反向传播，计算梯度，\n",
    "    optimizer.step() #更新模型参数\n",
    "    if epoch % 50 ==0:\n",
    "        print('epoch {}, loss {}'.format(epoch, loss.item()))\n",
    "\n",
    "print('epoch {}, loss {}'.format(epoch, loss.item()))\n",
    "\n",
    "predict_Y = model(inX)\n",
    "# print(predict_Y)\n",
    "\n",
    "# for name,p in model.named_parameters():\n",
    "#     print(name,p)\n",
    "\n",
    "# print(model.state_dict())\n",
    "\n",
    "pw = -model.state_dict()[\"linear.weight\"][0][0].item()/(model.state_dict()[\"linear.weight\"][0][1].item()+delta)\n",
    "pb = -model.state_dict()[\"linear.bias\"][0].item()/(model.state_dict()[\"linear.weight\"][0][1].item()+delta)\n",
    "print(\"weight:\",pw,pb)\n",
    "\n",
    "plt.plot(x1, y1, '*', color='green')\n",
    "plt.plot(x2, y2, 'x', color='blue')\n",
    "plt.plot([0,1],[pb,pw+pb])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1f24c6db",
   "metadata": {},
   "source": [
    "sigmoid 和 softmax 的联系和区别？\n",
    "\n",
    "* Sigmoid=>多标签分类问题=>多个正确答案=非独占输出\n",
    "\n",
    "* Softmax=>多类别分类问题=>只有一个正确答案=>互斥输出（所有概率总和为1）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "a31101c6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "softmax n=4: [[0.0320586  0.08714432 0.23688282 0.64391426]\n",
      " [0.83902451 0.04177257 0.11354962 0.0056533 ]]\n",
      "softmax n=2: [[0.26894142 0.73105858]\n",
      " [0.95257413 0.04742587]]\n",
      "torch sigmoid: tensor([[0.7311, 0.8808],\n",
      "        [0.9933, 0.8808]])\n",
      "sigmoid: [[0.73105858 0.88079708]\n",
      " [0.99330715 0.88079708]]\n"
     ]
    }
   ],
   "source": [
    "def softmax(x,axis=-1):\n",
    "    exp_x = np.exp(x-np.max(x,axis=axis, keepdims=True))\n",
    "    sum_exp_x = np.sum(exp_x,axis=axis, keepdims=True)\n",
    "    y = exp_x / sum_exp_x\n",
    "    return y \n",
    "\n",
    "inpu_1 = np.array([[1,2,3,4],[5,2,3,0]])\n",
    "print(\"softmax n=4:\", softmax(inpu_1))\n",
    "\n",
    "inpu_2 = np.array([[1,2],[5,2]])\n",
    "print(\"softmax n=2:\", softmax(inpu_2))\n",
    "print(\"torch sigmoid:\",torch.sigmoid(torch.tensor(inpu_2)))\n",
    "print(\"sigmoid:\", sigmoid(inpu_2))\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "862509bb",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
